mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Allow database migration from legacy versions even if the perms_label column is missing in the groups table
This fixes issue #366 and #67
This commit is contained in:
parent
55943f5d8f
commit
4bed50d894
2 changed files with 24 additions and 0 deletions
|
@ -69,6 +69,12 @@ final class Version20190902140506 extends AbstractMultiPlatformMigration
|
|||
//For attachments
|
||||
$this->addSql('DELETE FROM `attachements` WHERE attachements.class_name = "Part" AND (SELECT COUNT(parts.id) FROM parts WHERE parts.id = attachements.element_id) = 0;');
|
||||
|
||||
//Add perms_labels column to groups table if not existing (it was not created in certain legacy versions)
|
||||
//This prevents the migration failing (see https://github.com/Part-DB/Part-DB-server/issues/366 and https://github.com/Part-DB/Part-DB-server/issues/67)
|
||||
if (!$this->doesColumnExist('groups', 'perms_labels')) {
|
||||
$this->addSql('ALTER TABLE `groups` ADD `perms_labels` SMALLINT NOT NULL AFTER `perms_tools`');
|
||||
}
|
||||
|
||||
/**************************************************************************************************************
|
||||
* Doctrine generated SQL
|
||||
**************************************************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue