Skip to content

Commit

Permalink
Merge pull request #54 from SonicGarden/kzkn-20240529
Browse files Browse the repository at this point in the history
[review] sg_fargate_rails:db_migrate を追加
  • Loading branch information
interu authored Jun 7, 2024
2 parents 6fbf8b0 + 1fe50c5 commit cf58707
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sg_fargate_rails/exit_code.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SgFargateRails
EXIT_CONCURRENT_MIGRATION_ERROR = 100
end
7 changes: 7 additions & 0 deletions lib/tasks/sg_fargate_rails.rake
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ namespace :sg_fargate_rails do
end
end
end

desc 'Migrate the database with handling ConcurrentMigrationError'
task db_migrate: :environment do
Rake::Task["db:migrate"].execute
rescue ActiveRecord::ConcurrentMigrationError
exit SgFargateRails::EXIT_CONCURRENT_MIGRATION_ERROR
end
end

0 comments on commit cf58707

Please sign in to comment.