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 ran rake db:reset
. This dropped the DB, created it again, loaded the schema, and ran what's in db/seeds.rb
.
Hope you can use the same.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.