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

Upgrade with MySQL backend : "Data too long for column 'carddata'" #128

Closed
dominiquefournier opened this issue Jan 2, 2024 · 5 comments
Closed

Comments

@dominiquefournier
Copy link

I try to migrate my old 3.3 version to 4.3. I have a MySQL backend
When updating the schemes, the error raised :

bin/console doctrine:migrations:migrate

 WARNING! You are about to execute a migration in database "cal" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 > 

[notice] Migrating up to DoctrineMigrations\Version20231229203515
[notice] Migration DoctrineMigrations\Version20221211154443 skipped during Execution. Reason: "This migration is specific to 'sqlite'. Skipping it is fine."
[notice] Migration DoctrineMigrations\Version20230209142217 skipped during Execution. Reason: "This migration is specific to 'postgresql'. Skipping it is fine."
[error] Migration DoctrineMigrations\Version20231001214111 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'carddata' at row 35"
07:29:47 CRITICAL  [console] Error thrown while running command "doctrine:migrations:migrate". Message: "An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'carddata' at row 35" ["exception" => Doctrine\DBAL\Exception\DriverException^ { …},"command" => "doctrine:migrations:migrate","message" => "An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'carddata' at row 35"]

The conversion from longblob to text doesn't works.
The SQL request is : ALTER TABLE cards CHANGE carddata carddata TEXT DEFAULT NULL; from Version20231001214111.php

@dominiquefournier
Copy link
Author

dominiquefournier commented Jan 2, 2024

The provided id has an image and the size is 100ko. The TEXT field has 64KB max. The LONGBLOB should be converted to LONGTEXT (4Go max)
If I do it manually, the migration works.

@tchapi
Copy link
Owner

tchapi commented Jan 2, 2024

Hi @dominiquefournier 👋🏼

Guess what: #127 :)

I could change the old migration to allow MEDIUM TEXT directly but it's a bit tricky and would likely break existing installations or new migration runs. I will release the next version this week though.

@dominiquefournier
Copy link
Author

Hi @thapi
Thanks to point his, I didn't saw it.
You are right, but the upgrade process crash on Version20231001214111.php if data already exists.
You may update this file too.

@tchapi
Copy link
Owner

tchapi commented Jan 2, 2024

You may update this file too.

I may do this yes, but changing a previous migration is not really recommended. I'll test further

@tchapi
Copy link
Owner

tchapi commented Jan 12, 2024

Done here

@tchapi tchapi closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants