le1t0-deprec 2.1.6.028 → 2.1.6.029
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/deprec/recipes/rails.rb +17 -9
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/deprec/recipes/rails.rb
CHANGED
@@ -33,6 +33,14 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
33
33
|
top.deprec.web.reload if web_choice.to_s != 'none'
|
34
34
|
top.deprec.rails.setup_database
|
35
35
|
end
|
36
|
+
|
37
|
+
before 'deploy:migrate' do
|
38
|
+
unless ENV['DO_SEED']
|
39
|
+
top.deprec.rails.database.create
|
40
|
+
else
|
41
|
+
top.deprec.rails.database.seed
|
42
|
+
end
|
43
|
+
end
|
36
44
|
|
37
45
|
after 'deploy:symlink', :roles => :app do
|
38
46
|
top.deprec.rails.symlink_shared_dirs
|
@@ -302,32 +310,32 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
302
310
|
namespace :database do
|
303
311
|
|
304
312
|
desc "Create database"
|
305
|
-
task :create, :roles => :
|
306
|
-
run "cd #{deploy_to}/current && rake db:create RAILS_ENV=#{rails_env}"
|
313
|
+
task :create, :roles => :db, :only => { :primary => true } do
|
314
|
+
run "cd #{deploy_to}/current && rake db:schema:dump || rake db:create RAILS_ENV=#{rails_env}"
|
307
315
|
end
|
308
316
|
|
309
|
-
desc "
|
310
|
-
task :seed, :roles => :
|
311
|
-
run "cd #{deploy_to}/current && rake db:seed RAILS_ENV=#{rails_env}"
|
317
|
+
desc "Create and seed database"
|
318
|
+
task :seed, :roles => :db, :only => { :primary => true } do
|
319
|
+
run "cd #{deploy_to}/current && rake db:schema:dump || rake db:create db:seed RAILS_ENV=#{rails_env}"
|
312
320
|
end
|
313
321
|
|
314
322
|
desc "Redo database, only available if defined in your app"
|
315
|
-
task :redo, :roles => :
|
323
|
+
task :redo, :roles => :db, :only => { :primary => true } do
|
316
324
|
run "cd #{deploy_to}/current && rake db:redo RAILS_ENV=#{rails_env}"
|
317
325
|
end
|
318
326
|
|
319
327
|
desc "Run database migrations"
|
320
|
-
task :migrate, :roles => :
|
328
|
+
task :migrate, :roles => :db, :only => { :primary => true } do
|
321
329
|
run "cd #{deploy_to}/current && rake db:migrate RAILS_ENV=#{rails_env}"
|
322
330
|
end
|
323
331
|
|
324
332
|
desc "Run database migrations"
|
325
|
-
task :schema_load, :roles => :
|
333
|
+
task :schema_load, :roles => :db, :only => { :primary => true } do
|
326
334
|
run "cd #{deploy_to}/current && rake db:schema:load RAILS_ENV=#{rails_env}"
|
327
335
|
end
|
328
336
|
|
329
337
|
desc "Roll database back to previous migration"
|
330
|
-
task :rollback, :roles => :
|
338
|
+
task :rollback, :roles => :db, :only => { :primary => true } do
|
331
339
|
run "cd #{deploy_to}/current && rake db:rollback RAILS_ENV=#{rails_env}"
|
332
340
|
end
|
333
341
|
|