I am setting up a test environment for unit tests, following Symfony's Test-Guide. However each time I deploy the test-DB the final tables look slightly different than the originals from the production db.
That means
- some columns appear on another position in table
- some indexes/keys are missing or added
- some indexes/keys copied from prod-db are unique in test-db but the originals are not
I use migration files to build up the production-db. Maybe I am doing the test-db setup in wrong order regarding the production db setup?
This is what I am doing:
Step | Action | Command |
---|---|---|
1 | Remove all databases | mysql -e "DROP DATABASE prod_db" //... |
2 | Add production db | mysql -e "CREATE DATABASE prod_db" |
3 | Execute migrations for production db | php bin/console doctrine:migrations:migrate |
4 | Add test-db | php bin/console --env=test doctrine:database:create |
5 | Create test-db schema | php bin/console --env=test doctrine:schema:create |
Q: What is the cause of the differences?