Skip to content
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

You don't build the db with db:migrate #69

Open
kvirani opened this issue Nov 24, 2013 · 4 comments
Open

You don't build the db with db:migrate #69

kvirani opened this issue Nov 24, 2013 · 4 comments

Comments

@kvirani
Copy link

kvirani commented Nov 24, 2013

The README asks you to setup the db using the rake db:migrate command. This is incorrect. Migrations are not how new developers get their database setup. The schema.rb is to be used for this. In fact, you should be able to delete old migration files from the project file without consequence to new contributors.

The rake db:schema:load (or better yet the rake db:setup) is what should be used to create the database based on the schema defined in the schema.rb file, instead of using migration files.

http://stackoverflow.com/questions/10122772/remove-past-migration-in-rails/10123000#10123000

@amxn
Copy link

amxn commented Nov 24, 2013

While it's true that rake db:schema:load is the proper method to build a db, the migrations would still be required if any rake db:rollback operations are to be performed. Rollbacks affect the schema and the db it corresonds to.

@kvirani
Copy link
Author

kvirani commented Nov 24, 2013

I'm assuming you're referring to my comment about deleting migrations...

I was referring to deleting migrations that are old, not recent. And
moreover I was saying that to make the point that they should be not
considered definitive.

I'll also add that migrations that work fine today will sometimes even fail
months in the future, especially if things get renamed. Further proof that
migrations should not be used to build up a db.

Anyway, are you agreeing that the instructions should be changed, or do you
feel it should stay as is?

Khurram Virani

On Sat, Nov 23, 2013 at 9:04 PM, Mohammed Ameen [email protected]:

While it's true that rake db:schema:load is the proper method to build a
db, the migrations would still be required if any rake db:rollbackoperations are to be performed. Rollbacks affect the schema and the db it
corresonds to.


Reply to this email directly or view it on GitHubhttps://github.com//issues/69#issuecomment-29149083
.

@amxn
Copy link

amxn commented Nov 24, 2013

rake db:schema:load or rake db:setup which essentially is a shortcut for rake db:create && rake db:schema:load && rake db:seed is usually how we create db's on new projects/machines.

I'd agree with changing the instructions as recreating a db overtime solely through migrations would not be feasible (essentially if later migrations affect older ones or any irreversible migrations are performed)

Also if you strongly feel that the instructions are to be changed edit the readme and send in a pull request with the updated instructions for recreating the db.

@kvirani
Copy link
Author

kvirani commented Nov 24, 2013

Great, will do. Thanks

Khurram Virani

On Sat, Nov 23, 2013 at 10:10 PM, Mohammed Ameen
[email protected]:

rake db:schema:load or rake db:setup which essentially is a shortcut for rake
db:create && rake db:schema:load && rake db:seed is usually how we create
db's on new projects/machines.

I'd agree with changing the instructions as recreating a db overtime
solely through migrations would not be feasible (essentially if later
migrations affect older ones or any irreversible migrations are performed)

Also if you strongly feel that the instructions are to be changed edit the
readme and send in a pull request with the updated instructions for
recreating the db.


Reply to this email directly or view it on GitHubhttps://github.com//issues/69#issuecomment-29149719
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants