18 May 01:51
Re: Combine old migrations?
From: Jeremy McAnally <jeremymcanally@...>
Subject: Re: Combine old migrations?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-17 23:51:17 GMT
Subject: Re: Combine old migrations?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-17 23:51:17 GMT
Right. Schema loading is just for that purpose; migrating is just for incremental updates to the schema. Even better, when you load schema.rb, it'll set the proper version so you can pick up from there using migrations just like it would if you were to do db:migrate. This discrepancy is one of the biggest reasons you should never have data/logic in your migrations. If you do a schema:load, then you miss out on whatever seed data is in the migration. You should instead create something like rake db:bootstrap in lib/tasks or something. --Jeremy On Sat, May 17, 2008 at 7:44 PM, Nathan Esquenazi <rails-mailing-list@...> wrote: > > From schema.rb > > # Note that this schema.rb definition is the authoritative source for > your database schema. If you need > # to create the application database on another system, you should be > using db:schema:load, not running > # all the migrations from scratch. The latter is a flawed and > unsustainable approach (the more migrations > # you'll amass, the slower it'll run and the greater likelihood for > issues). > > In short, one reason you don't really need to consolidate migrations is > because when deploying a application to a new server, you should really > not use db:migrate because it can be slow, amass alot of redundancy, > etc. Loading the latest schema is a much better practice. > > so when starting from scratch use: > > rake db:schema:load > > over > > rake db:migrate > > (in most cases) > > That said, I don't think consolidating old migrations is necessarily bad > if its a personal project and no one else is relying on the migrations. > > In fact, before a project is deployed for release, I tend to use: > > http://errtheblog.com/posts/65-automatically > -- > Posted via http://www.ruby-forum.com/. > > > > -- http://jeremymcanally.com/ http://entp.com Read my books: Ruby in Practice (http://manning.com/mcanally/) My free Ruby e-book (http://humblelittlerubybook.com/) Or, my blogs: http://mrneighborly.com http://rubyinpractice.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
RSS Feed