Last active
August 11, 2023 16:08
-
-
Save tannakartikey/670075606f9284f3b6e5c90bb340265b to your computer and use it in GitHub Desktop.
Destroy the schema and re-create the database from scratch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
desc 'reset the database by dropping the schema' | |
task complete_reset: :environment do | |
raise unless Rails.env.local? | |
FileUtils.rm_f('db/schema.rb') | |
Rake::Task['db:drop'].invoke | |
Rake::Task['db:create'].invoke | |
Rake::Task['db:migrate'].invoke | |
Rake::Task['db:seed'].invoke | |
Rake::Task['dev:prime'].invoke | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you!
Can I suggest to clear also the schema cache with
Rake::Task['db:schema:cache:clear'].invoke
?