I'm using Rails 5 with Minitest 5.9.
I have some views in my application for complex queries.
Everytime I create a new migration my test database removes my views and I have to recreate them.
How do I automate the view recreation?
I'm using Rails 5 with Minitest 5.9.
I have some views in my application for complex queries.
Everytime I create a new migration my test database removes my views and I have to recreate them.
How do I automate the view recreation?
I had a similar problem. We had some triggers on our DB, which could not be created by rails migration.
The solution we followed is using seeds. We defined our triggers in
db/seeds.rb
, and before running the tests, we ranrake db:reset
. This dropped the DB, created it again, loaded the schema, and ran what's indb/seeds.rb
.Hope you can use the same.