phinx-migrations-generator icon indicating copy to clipboard operation
phinx-migrations-generator copied to clipboard

MariaDB 10.5.21 - Tables with SYSTEM VERSIONING seem to be ignored

Open mp-improvement-it opened this issue 2 years ago • 1 comments

Hi Odan & team, first of all big kudo's to your work! What a perfect automated solution to generate migrations.

While generating a migration of my DB I happened to bump into a peculiarity... 1 table was skipped.

After doublechecking I found it was the table which had SYSTEM VERSIONING switched on. Once I switched off SYSTEM VERSIONING your library was able to generate a migration for that particular table.

==How to reproduce?==

Add a table with versioning:

CREATE TABLE FooBar ( FooBarIDbinary(16) PRIMARY KEY NOT NULL DEFAULT unhex(replace(uuid(),'-','')),Namevarchar(45) UNIQUE NOT NULL,LastModifiedtimestamp NOT NULL DEFAULT current_timestamp(),LastModifiedByID binary(16) DEFAULT NULL ) WITH SYSTEM VERSIONING;

Run vendor/bin/phinx-migrations generate

You'll see the new migration does not contain table FooBar.

I am aware SYSTEM VERSIONING is not entirely database agnostic across different databases. But I still would have expected the table to at least appear in the migration (potentially without system versioning) or maybe a warning or even exception making the user aware of system versioned tables being skipped.

Curious to your opinion. Thanks!

mp-improvement-it avatar Nov 14 '23 15:11 mp-improvement-it

Hi @mp-improvement-it

This phinx-migration package is designed to create migration classes that are also supported by phinx itself. Phinx is primarily designed to work with migrations in a database-agnostic way, which means it may not have built-in support for database-specific features like SYSTEM VERSIONING from MariaDB.

Do you know any Phinx specific method or parameter to generate a table with such a specific parameter?

https://book.cakephp.org/phinx/0/en/migrations.html#

PS: I'm currently working a new major version for this package, where it will be possible to generate native SQL statements instead of using the Phinx methods. Maybe this should solve this issue.

odan avatar Nov 14 '23 18:11 odan