Em 18-02-2013 08:05, mrloz escreveu:
Hi Folks,
There is much discussion where I work at present regarding migrations,
and the 'correct' usage or not of them.
TL;DR
Should migrations be used just to modify schema, and other 'deploy'
tasks done other ways? If yes, how to ensure no repeat runs of such
tasks (seeds, jobs etc)
Even if you just modify schemas, the only reliable way I know of
recreating your db is to run all migrations. The guides tell you otherwise:
http://guides.rubyonrails.org/migrations.html#schema-dumping-and-you
"There is no need (and it is error prone) to deploy a new instance of an
app by replaying the entire migration history. It is much simpler and
faster to just load into the database a description of the current schema."
This doesn't work for many cases if your schema format is :ruby (the
default). For instance, my application makes use of different PostgreSQL
schemas to organize some tables.
Also, I strongly believe that you're wrong if you're not using foreign
keys in your database. That's why I believe the :ruby format should
either support foreign keys representation or :sql should be the default
one.
But looking at the guide it seems it's not Rails opinion on the subject:
" The Active Record way claims that intelligence belongs in your models,
not in the database. As such, features such as triggers or foreign key
constraints, which push some of that intelligence back into the
database, are not heavily used."
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.