thomthom's avatar

DatabaseMigrations vs DatabaseTransactions

I have been using DatabaseMigrations with a in memory sqlite db for my tests on this project of mine. However, I need to switch to MySQL as I need some SQL features that sqlite doesn't support.

With MySQL, is it better to use DatabaseTransaction? (Get the impression of migrations with MySQL is heavier than sqlite...)

0 likes
4 replies
thomthom's avatar

Ah nice - I had not seen that video. That described things perfectly.

kyslik's avatar

Sidenote: Its nice to run tests in memory but if you work with constraints and unique keys you may get in trouble, always set up Travis CI to use not only :memory: but also MySQL or PostgreSQL.

Or simply in the end of the day run test suite on any database other than sqlite.

cameronwilby's avatar

Laravel 5.5+ has the RefreshDatabase trait which uses the same logic as the link @drfraker posted

8 likes

Please or to participate in this conversation.