In a rails app in my experience it is not safe to have a mismatch between code and schema because your models infer some of their behavior from the schema. So if for example you add a column that dissalows null entries and has no default value then when your old model tries to save an otherwise valid set of data the app will throw a activerecord::invalid error.

Related problems come from consuming your models inside of migrations. A common thing that will happen is a validation is added to a model that was used in an earlier migration. When the migrations are used on current databases there's no problem. But when the migration is used to create a cratch intallation it bombs because the new model code doesn't match the earlier migration schema and attempts to validate fields that don't exist yet.

On Jul 14, 2010, at 2:47 PM, Hassan Schroeder <[email protected] > wrote:

On Wed, Jul 14, 2010 at 12:38 PM, gwgeller <[email protected] > wrote:

  I have situations where it would be nice to have the tables setup
in the production db before actually deploying the code that uses
them.

Of course there's always a chance that having updated tables with
old code will cause problems, so you have to either evaluate that on
a case-by-case basis, or have a separate staging environment to
test this on, but --

As long as your production DB is reachable over the network, you
can run migrations from anywhere just by setting your RAILS_ENV
to production. That's what I do with one of my clients.

Then deploy as usual.

FWIW,
--
Hassan Schroeder ------------------------ [email protected]
twitter: @hassan

--
* You received this message because you are subscribed to the Google Groups "Capistrano" 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/capistrano?hl=en

--
* You received this message because you are subscribed to the Google Groups 
"Capistrano" 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/capistrano?hl=en

Reply via email to