On Nov 13, 2007, at 9:17 PM, Stephen Touset wrote:

>
> Reading the Rails commit logs, I see that db/schema.rb's purpose has
> been clarified. It's intended to be the authoritative location for
> your database schema, and rake tasks like db:reset use it to rebuild
> the schema rather than running migrations.
>
> This raises several questions for me.
>
> 1 ) What, then, is the preferred mechanism for "seed" data in the
> database? Currently, many people use migrations to insert bootstrap
> data. If schema.rb will be used for tasks like db:reset, none of this
> data will be loaded.
>
> 2 ) What about those of us who specify additional options like charset
> or table types? This information, last time I checked, doesn't seem to
> be saved in the schema.rb.
>
> 3 ) Should there be yet another database-related Rake task for
> development? Many of us create migrations, then modify them until
> we're ready to commit. A simple "rake db:reset" used to re-run the
> migrations from scratch, but the new semantics mean that migration
> changes are never reflected.
>

we are using timestamped migrations and the first one is stamped like  
this:

   00000000000042_schema.rb

thus, it's before any other timestamped migration, most of which look  
like this

   20071103035131_globalize_migration.rb

the '42' migration looks for a file, db/dump.gz, which iff found it  
assumed to be a binary dump of the db.  this will typically be dumped  
from production, for instance.  when found it's loaded.  this has the  
side effect of also loading the schema_info table so it short  
circuits all the other migrations if, and only if, they were run on  
the production db.  if you have a newer migration locally then that  
will be run.

we also have custom db:down and db:up tasks which drop the db, create  
it, and then run db:migrate.

so far this is working quite well.

regards.

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to