Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add migration_command accessor for overriding #242

Merged
merged 1 commit into from
Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# [master][]

* Your contribution here!
* Added option `:migration_command` to allow overriding the default `db:migrate` used.

# [1.5.0][] (May 15 2020)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ set :migration_role, :db
# Defaults to the primary :db server
set :migration_servers, -> { primary(fetch(:migration_role)) }

# Defaults to `db:migrate`
set :migration_command, 'db:migrate'

# Defaults to false
# Skip migration if files in db/migrate were not modified
set :conditionally_migrate, true
Expand Down
3 changes: 2 additions & 1 deletion lib/capistrano/tasks/migrations.rake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace :deploy do
on fetch(:migration_servers) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'db:migrate'
execute :rake, fetch(:migration_command)
end
end
end
Expand All @@ -36,5 +36,6 @@ namespace :load do
set :conditionally_migrate, fetch(:conditionally_migrate, false)
set :migration_role, fetch(:migration_role, :db)
set :migration_servers, -> { primary(fetch(:migration_role)) }
set :migration_command, -> { fetch(:migration_command, 'db:migrate') }
end
end