Rob Biedenharn wrote: [...] > Matt, Pito, Marnen, and anyone else, > > 1. The opinion on whether db/schema.rb goes into the source repository > has changed over time.
No. I've used Rails since 1.2.6. Every version has put a comment in the schema.rb file that recommends putting it into version control. > It is an opinion. (I'll give you some of mine.) Opinion is not an excuse for advocating dangerous practices. > > 2. When properly written, migration files are not "prone to having > problems" and certainly do not have to get worse over time. The advise > here is to define at least a minimal version of your AR model class > nested within the migration class if you need to do *any* manipulation > at the model level. But you should never be running old migrations in the first place. If you need version 1000 of the schema for a new installation, then don't start at zero and run 1000 migrations -- just do rake db:schema:load and have done with it. This is the core team's recommendation, and I think it's a good one. > > 3. I think that db/schema.rb does *NOT* belong in the repository. Why not? Without it, you can't load the schema with Rake. > This is particularly true in a multi-developer environment where > migrations are being initially created on different branches. I don't see how this makes a difference. Your VCS should be able to merge the schema.rb files. If not, get a better VCS. > The > database itself isn't going into the repository after all. That's a red herring. > If you need > the file, run a rake db:schema:dump or just run migrations. No! You need the file so that rake db:schema:load is possible. You've got it completely backwards. > If you > think about why the migration numbering (file naming) was changed from > sequence number to timestamp, you'll realize that the practice of such > "interleaved" migrations was a much bigger pain-point than what to do > about db/schema.rb. I don't really understand what you're getting at here. > > 4. Unless you're initializing (inserting) data via migration, running > all the migrations is really not much different than doing a > db:schema:load because all the migrations are operating on empty > tables. How can you say this with a straight face? There is no reason *at all* to run lots of migrations rather than doing a simple schema load. > (Besides, if you have to "scale up your app", you probably > aren't adding a new empty database, but creating a master-slave or > sharding for performance.) Another red herring. Rob, I know you know a lot about the Rails framework, but your advice here will make dealing with databases far more difficult than it needs to be. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > [email protected] Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

