-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Mongodb in installer #1161
Support for Mongodb in installer #1161
Conversation
defp get_ecto_adapter("mongodb", app) do | ||
{:mongodb_ecto, Mongo.Ecto, | ||
dev: [database: "#{app}_dev"], | ||
test: [database: "#{app}_test", pool_size: 1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to limit the pool size in mongo, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we won't get into troubles with resetting the database during tests with concurrent connections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't hurt to keep it I guess. :)
I tested this out and generating a project with While not strictly related to the installer and this PR, I noticed that the user is instructed to run It doesn't hurt anything to run it (it just says "Already up") but I wonder if the message could be suppressed? [1] I used |
This is a great point. I feel like we can go even further and remove the migration message every time the generator is called with the Unfortunately this message is today printed in the |
👍 |
If a migration is needed, then the order of those messages does matter. For example with Postgres if you generate a model with
So it must be "Add the resource... and then update your repository..." in that case. ETA: Which should not prevent this PR getting merged -- we're talking about messages printed by the other tasks, not the installer. :) |
I've been out of the loop for a few days. Where do we stand on this? We're prepping a 1.0.1 release, and it would be nice to get this in. What's left? |
@chrismccord I don't think we should include new features on 1.0.1. :) Otherwise it may have one tiny bug... which will force us to define 1.0.2 and so on. I would hold this for v1.1. |
@josevalim roger that. This border lines on enhancement, but you are right it could introduce new project issues, so we can sit on it |
* Run gen.model as last step of gen.html and gen.json * Emit migration instruction only when migrations are generated
f1a3d65
to
6d80dc2
Compare
I rebased the PR, and changed the generators not to emit migration instructions when migration is not generated. This changed a little bit the order of messages (the creating ones and the instructions for user are interleaved). Is this a problem? The output of
The output of
|
Can't you print the routes one after you invoke the model? |
But we need users to add the routes before running migrations. |
It's not possible to let the phoenix.gen.x mix tasks add the new resource to the "/"-scope in router.ex by default, and give users the option to change this behaviour, by passing something like "/api:scope /web/different_router:path" or "--no-router-change" as arguments for example? |
@Theemuts I don't think it's possible to insert this into the router. The router is 100% code, and can be quite complex (for example you can have multiple scopes with the same basic route, but different pipelines). Figuring out the right place to put the new route would be horrible. @chrismccord @josevalim I understand decision to delay new features until a new minor version. Can you give some approximation how long will it take for 1.1? I don't want a concrete date, but rather a time-frame - is it going to be more like a week, a month or a year? Because, if it's going to be a year, it may be sensible to provide some alternate way of creating projects with mongodb. |
On the order of months, but much less than a year. I can't say much beyond that unfortunately |
If it's going to be that long, I'd love to find an easier way of getting this into the hands of early adopters who aren't quite ready to build it themselves. I was in a hurry with http://wsmoak.net/2015/08/31/phoenix-ecto-mongodb.html expecting this PR to get merged out from under me at any minute. I'm going to re-work it and see if there's an easier way to get a bleeding-edge installer from Michał’s branch. Any chance there is already a CI server that the branch could be added to that would make the installer artifact available for download? |
@wsmoak we have instructions for building the installer, which is hopefully straight-forward: https://github.com/phoenixframework/phoenix/tree/master/installer If it doesn't work, please let us know. The only issue I can see in using the installer with current Phoenix 1.0 is that ecto.model will always generate a migration. At least this is easy to work around by passing |
@michalmuskala have you fixed the order of messages? And, if so, is this ready to go? |
We have decided to include this in the next release. Thank you everyone! |
Support for Mongodb in installer
Thank you! Unfortunately, I have not solved the message ordering issue. It's still mixed. I have no idea how to solve this in some approachable way. Two solutions I see is to either store the instructions for user in some agent, and show them all at the end of running generators. I don't like this very much, because it introduces a ton of complexity. The other way is to have additional argument for the |
Adds support for:
binary_id
as default in ecto models in installerbinary_id
in the model generator