:card_file_box: Issue #3540 db migration
This PR fixes issue #3540 and updates the Doctrine migrations to update MySQL/MariaDB database from Bolt version 4.2, 5.0, and 5.1.
A GitHub Action workflow has been added to check if migration is missing in the future (only for MySQL/MariaDB).
This PR is ready to review. Sorry for the noise during the development ;-)
Related issue #3021
Hii @macintoshplus, the migrations are dropping tables first before re-creating them. What if I have data in those tables that needs to be preserved?
Hii @macintoshplus, the migrations are dropping tables first before re-creating them. What if I have data in those tables that needs to be preserved?
The migration does not remove existing tables and data. It's the goal to use migrations.
Bolt can used with various DBMSs like SQLite (used in test mainly), MariaDB/MySQL, or Postgres. Generating one migration for 3 DBMSs is so hard. However using migration is necessary to manage changes with data effect.
In this PR, I have added the database dumps for MySQL/MariaDB to enable the migration tests and check if no change has been lost in migrations.
Hii @macintoshplus, the migrations are dropping tables first before re-creating them. What if I have data in those tables that needs to be preserved?
The migration does not remove existing tables and data. It's the goal to use migrations.
Bolt can used with various DBMSs like SQLite (used in test mainly), MariaDB/MySQL, or Postgres. Generating one migration for 3 DBMSs is so hard. However using migration is necessary to manage changes with data effect.
In this PR, I have added the database dumps for MySQL/MariaDB to enable the migration tests and check if no change has been lost in migrations.
I am sorry if I misunderstood this PR then. So can I now safely upgrade from Bolt 5.1 to the latest 5.2.2 and run (how please?) DB migrations or should I wait for this PR to be merged?
Hii @macintoshplus, the migrations are dropping tables first before re-creating them. What if I have data in those tables that needs to be preserved?
The migration does not remove existing tables and data. It's the goal to use migrations. Bolt can used with various DBMSs like SQLite (used in test mainly), MariaDB/MySQL, or Postgres. Generating one migration for 3 DBMSs is so hard. However using migration is necessary to manage changes with data effect. In this PR, I have added the database dumps for MySQL/MariaDB to enable the migration tests and check if no change has been lost in migrations.
I am sorry if I misunderstood this PR then. So can I now safely upgrade from Bolt 5.1 to the latest 5.2.2 and run (how please?) DB migrations or should I wait for this PR to be merged?
You have 2 choices:
- Upgrade to Bolt 5.2.2, run the actual migration and generate a new Doctrine migration to complete the migration (and execute it).
- Wait this PR was merged and upgrate after the new Bolt version has published.
To execute migration run this command: bin/console doctrine:migration:migrate
Hi @macintoshplus and @bobvandevijver. Is there any blocker or can this be merged please?
I can't merge without review validation. Please wait.
I'm currently planning on fully removing the supplied migrations from Bolt core in version 6, as migrations heavily depend on the exact database being used. Bolt does offer the entities and will still offer the required schema for the database, it just becomes the developer responsibility to make them. I will look into offering a migration guide to squash your existing migrations, something like described here: https://jolicode.com/blog/a-new-way-to-squash-your-doctrine-migrations.