-
Notifications
You must be signed in to change notification settings - Fork 15
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
IBX-9617: Fixed DB schema reinstallation #485
base: 4.6
Are you sure you want to change the base?
Conversation
Answering "yes" to "Continue?" just throw errors and fail. SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
More cross-platform solution.
If written only for FKs, it didn't work.
|
$tables = $newSchema->getTables(); | ||
if ($databasePlatform->supportsForeignKeyConstraints()) { | ||
// cleanup pre-existing database: drop foreign keys | ||
foreach ($tables as $table) { | ||
if ($existingSchema->hasTable($table->getName())) { | ||
foreach ($this->db->getSchemaManager()->listTableForeignKeys($table->getName()) as $foreignKeyConstraint) { | ||
$statements[] = $databasePlatform->getDropForeignKeySQL($foreignKeyConstraint->getName(), $table->getName()); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels to me like a workaround. Tables should be dropped in a correct order. Have you tried to see if we can reorganize tables order in Yaml for doctrine schema instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alongosz I didn't. I replaced the not-working array_reverse
trick with another trick.
Studying how the table list is loaded/built from YAML schema is probably also necessary to understand why 3 tables are missing. But my knowledge of Doctrine is limited and I don't manage to explore this schema declaration.
Description:
Before:
Issues:
Fixes:
After:
Remaining issue I'm not able to fix by myself:
ibexa_payment_token
,ibexa_taxonomy_assignments
, andibexa_taxonomy_entries
.SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'tags-root' for key 'ibexa_taxonomy_entries_identifier_idx'
is thrown, and probably other errors of this kind are waiting behind it.For QA:
Documentation: