-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
DB migration issue #260
Comments
Have you run the migration command already, sometime before you copied this error message? The error can change on subsequent runs, when the database was already modified by earlier failed migration attempts. I think the easiest way to debug this, would be if you could send me a SQL dump of your database (the backuped version, before you tried to migrate). |
Thanks for the tip, to test I have now done the following: WARNING! You are about to execute a migration in database "usr_web483_1" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]: [notice] Migrating up to DoctrineMigrations\Version20230220221024 In ExceptionConverter.php line 117: An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY In Exception.php line 28: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY In Connection.php line 70: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] []` usr_web483_1.zip |
…f they really exist This should fix issue #260
For some reason, your database is completely missing every foreign key, even though it has the indices, which should have been created in the same migration step in legacy Part-DB. The new Part-DB deletes this keys to modify them, which caused this exception when the FK were not already existing. Now it is checked that the foreign keys are existing before trying to delete them and the migration should run smoothly. After the migration, your database should have the same structure as everybody else. Feel free to open the issue again, if you still encounter issues (Ensure that you use the backup database, which was not touched by any migration attempt) |
The migration could now be completed successfully. Many thanks for the support! |
I am running a Part-DB-legacy version: 0.5.15 (stable) and trying to migrate to the latest Git Master version of Part-DB-server and getting the following error message when trying to migrate:
`php bin/console doctrine:migrations:migrate
WARNING! You are about to execute a migration in database "usr_web483_1" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
[notice] Migrating up to DoctrineMigrations\Version20230220221024
[error] Migration DoctrineMigrations\Version20190902140506 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web483_1.attachements' doesn't exist"
01:32:47 CRITICAL [console] Error thrown while running command "doctrine:migrations:migrate". Message: "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web483_1.attachements' doesn't exist" ["exception" => Doctrine\DBAL\Exception\TableNotFoundException^ { …},"command" => "doctrine:migrations:migrate","message" => "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web483_1.attachements' doesn't exist"] ["token" => null,"command" => ["name" => "doctrine:migrations:migrate","arguments" => ["command" => "doctrine:migrations:migrate","version" => "latest"]]]
In ExceptionConverter.php line 49:
An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web483_1.attachements' doesn't exist
In Exception.php line 28:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web483_1.attachements' doesn't exist
In Connection.php line 70:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web483_1.attachements' doesn't exist
doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] []`
But the table is present in the database (=MariaDB version 10.5.18)
CREATE TABLE `attachements` ( `id` int(11) NOT NULL, `name` tinytext NOT NULL, `class_name` varchar(255) NOT NULL, `element_id` int(11) NOT NULL, `type_id` int(11) NOT NULL, `filename` mediumtext NOT NULL, `show_in_table` tinyint(1) NOT NULL DEFAULT 0, `last_modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO
attachements(
id,
name,
class_name,
element_id,
type_id,
filename,
show_in_table,
last_modified) VALUES (1, 'Bild', 'Part', 14, 1, '%BASE%/data/media/img_0559e001bbbee3fc82869ffb38bfe40b.jpg', 0, '0000-00-00 00:00:00'),
I tried to paste the corresponding error messages as code, but unfortunately it doesn't work at all .
The text was updated successfully, but these errors were encountered: