Hi guys
I just want to pass a snippet of code along in search of quality
feedback from other users.
We make extensive use of engines within our various projects. All
these engines are developed in-house, and are usually very generic
pieces of code that we overwrite in almost every application we use
(don't ask).
>From this we usually migrate our engines before we do our main
migration since any customizations to the engine will usually lead to
new columns being added or columns being replaced.
We use this little recipe as a standard in our projects that contain engines:
<before_migrate>
task :before_migrate do
timestamp = Time.now.strftime('%Y%m%d%H%M%S')
# the on_rollback handler is only executed if this task is executed within
# a transaction (see below), AND it or a subsequent task fails.
on_rollback { delete "/tmp/#{timestamp}.sql" }
# dump the database
run "mysqldump -u username -p db_production > tmp/#{timestamp}.sql"
do |ch, stream, out|
ch.send_data "password\n" if out =~ /^Enter password:/
end
# copy our database config file over
run "cp -f database.yml #{release_path}/config/"
# migrate the engines
run "cd #{release_path} && rake RAILS_ENV=production db:migrate:engines"
end
</before_migrate>
It works for our needs, but I would like to know if someone has a
better approach...
Thanks in advance, and as always: Jamis, thanks for capistrano
Best
--
Kenneth Kalmer
[EMAIL PROTECTED]
[EMAIL PROTECTED] stats
http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=kenneth%2Ekalmer
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---