mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed legacy database migration for newer MySQL version
This commit is contained in:
parent
c828aa3bc0
commit
557347d42d
1 changed files with 3 additions and 0 deletions
|
@ -71,7 +71,10 @@ final class Version20220925162725 extends AbstractMultiPlatformMigration
|
|||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE INDEX attachment_types_idx_name ON attachment_types (name)');
|
||||
$this->addSql('CREATE INDEX attachment_types_idx_parent_name ON attachment_types (parent_id, name)');
|
||||
//We have to disable foreign key checks here, or we get a error on MySQL for legacy database migration. On MariaDB this works fine (with enabled foreign key checks), so I guess this is not so bad...
|
||||
$this->addSql('SET foreign_key_checks = 0');
|
||||
$this->addSql('ALTER TABLE attachments CHANGE type_id type_id INT NOT NULL');
|
||||
$this->addSql('SET foreign_key_checks = 1');
|
||||
$this->addSql('CREATE INDEX attachments_idx_id_element_id_class_name ON attachments (id, element_id, class_name)');
|
||||
$this->addSql('CREATE INDEX attachments_idx_class_name_id ON attachments (class_name, id)');
|
||||
$this->addSql('CREATE INDEX attachment_name_idx ON attachments (name)');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue