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

feature: db:migrate:reset:with_data #161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ You can generate a data migration as you would a schema migration:
rake db:forward:with_data # Pushes the schema to the next version (specify steps w/ STEP=n)
rake db:migrate:down:with_data # Runs the "down" for a given migration VERSION
rake db:migrate:redo:with_data # Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x)
rake db:migrate:reset:with_data # Drops and creates a fresh database and runs all migrations.
rake db:migrate:status:with_data # Display status of data and schema migrations
rake db:migrate:up:with_data # Runs the "up" for a given migration VERSION
rake db:migrate:with_data # Migrate the database data and schema (options: VERSION=x, VERBOSE=false)
Expand Down
5 changes: 5 additions & 0 deletions tasks/databases.rake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ namespace :db do
Rake::Task["data:dump"].invoke
end

namespace :reset do
desc 'Drops and creates a fresh database and runs all migrations.'
task with_data: ["db:drop", "db:create", "db:migrate:with_data"]
end

namespace :redo do
desc 'Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).'
task :with_data => :environment do
Expand Down