Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗃️ Issue #3540 db migration #3543

Open
wants to merge 1 commit into
base: 5.2
Choose a base branch
from

Conversation

macintoshplus
Copy link
Contributor

@macintoshplus macintoshplus commented Mar 7, 2025

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).

@macintoshplus macintoshplus force-pushed the issue_3540_db_migration branch 7 times, most recently from 5bf05a5 to 2c0288b Compare March 7, 2025 23:53
@macintoshplus macintoshplus marked this pull request as draft March 10, 2025 13:58
@macintoshplus macintoshplus force-pushed the issue_3540_db_migration branch 4 times, most recently from 61266a4 to 1529cba Compare March 10, 2025 21:59
@macintoshplus macintoshplus marked this pull request as ready for review March 11, 2025 07:39
@macintoshplus macintoshplus self-assigned this Mar 11, 2025
@macintoshplus macintoshplus changed the title Issue #3540 db migration 🗃️ Issue #3540 db migration Mar 11, 2025
@macintoshplus macintoshplus marked this pull request as draft March 11, 2025 07:45
@macintoshplus macintoshplus force-pushed the issue_3540_db_migration branch 3 times, most recently from 3809593 to d78d246 Compare March 11, 2025 12:45
@macintoshplus macintoshplus marked this pull request as ready for review March 11, 2025 12:47
@macintoshplus
Copy link
Contributor Author

This PR is ready to review. Sorry for the noise during the development ;-)

@macintoshplus macintoshplus changed the base branch from master to 5.2 March 11, 2025 12:56
@macintoshplus macintoshplus force-pushed the issue_3540_db_migration branch from d78d246 to d6d516a Compare March 11, 2025 12:57
@macintoshplus
Copy link
Contributor Author

Related issue #3021

@Vondry
Copy link
Contributor

Vondry commented Mar 17, 2025

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?

@macintoshplus
Copy link
Contributor Author

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.

@Vondry
Copy link
Contributor

Vondry commented Mar 17, 2025

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?

@macintoshplus
Copy link
Contributor Author

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:

  1. Upgrade to Bolt 5.2.2, run the actual migration and generate a new Doctrine migration to complete the migration (and execute it).
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants