Cakephp v5 fixtures issue

Currently I am working on a rather large application and we are on version 4. I want to migrate to version 5 soon however, my biggest stumbling block is going to be the fixtures.

I have attempted to use the migration route but we have many partition tables and some column types which are not compatible with cakephp. Would the alternative be to just use an abstract schema? I am, of course, loathe to do this a bit due to the sheer size of the application and the database.

Another point on this, we currently have 3 different systems which all may at anyone time have slightly varying databases. The standard test, staging and live. I dont really get how the new way of doing fixtures actually works with this kind of setup. I of course can see mention of using a Schema Management Tool but I am unsure, again, how this would fit in.

Any assistance on this would be great. Thank you

If you can’t generate a fully compatible via migration_snapshot then your easiest solution would be to just use the SchemaLoader and load whatever .sql file you want to create your table schema/structure.

https://book.cakephp.org/migrations/3/en/index.html#generating-migrations-from-an-existing-database

app/tests/bootstrap.php at 5.x · cakephp/app · GitHub uncomment these 2 lines and remove the migrator.

1 Like

Whats the problem here? Migrations, which have not yet run on stage or live, are only on dev and thats fine.

Similar migrations, which have run on stage are also applied on dev but not yet on live.

1 Like

Yes, going to go with the SchemaLoader option for now as this is probably, for now, the easiest option. We are also transition to a distributed system so will need to try and find an external Schema Manager to deal with this

Yes, very good point. I did not think of that.

Thank you for both of your responses