Ruby on Rails Tuesday, September 5, 2017

People might have different opinions about this, but this is what I do:

If website is not deployed yet, then whatever, you can edit or delete existing migrations, then destroy current database and run `rails db:migrate` to rebuild database schema. I do this from time to time when trying out different things.

If website is deployed to production, you really shouldn't edit your existing migrations, because that goes against the whole idea of database migrations. Also those migrations simply won't run (that migration you edited, its version would already be in schema_migrations table).

But I think it's fine to delete old migrations (that are deployed and do not cause any issues). Your database schema file (db/schema.rb) is what defines your current database state, so after migrations are ran there are really no use for them anymore. In the worst case you'll still have those migrations in version control (if you use one - I hope you do).


On Tue, Sep 5, 2017 at 3:03 PM, Joe Guerra <JGuerra@jginfosys.com> wrote:
Just wondering if I can clean up some of migrations and merge them with others.

I've added a few things here and there to my database tables over time.

Thanks,
Joe

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/58c11dac-ec57-48cd-9fea-7eb4928cdcb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rolandas

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHP7vzApohT-%2B6yYOm030WgfRoUij8uvY280NvDaeFYEd9cZ-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment