A test database can be easily created from the existing schema; we have a schema:dump command which can facilitate this!
Apr 7, 2022
4
Level 4
How to test against an existing Database?
If you need to create an application that interacts with an existing database. What would be the best way to test your application?
I was thinking about:
- Creating migrations for the existing tables which only run in the testing environment.
- Override the connection to the "default" one in the boot method of the Models
Or is there a better way to do it?
Level 104
@mrcrmn off the top of my head, I don't know what will be different between sqlsrv and sqlite syntax for creating tables etc, but assume there will be issues!
The alternative is a Laravel Migrations Generator package which will generate migrations files instead.
Please or to participate in this conversation.