diff options
| author | Thomas Hackl <hackl@data-quest.de> | 2023-09-06 14:05:38 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-09-06 14:05:38 +0000 |
| commit | faa7fb47010712300e23ca490b3530be243cedfc (patch) | |
| tree | 41463acc6d69c359f244100d3ab15b157af51f9a /db/migrations | |
| parent | ef1bd917309b0d78a9b8d864faf8313b3665ea51 (diff) | |
Resolve "Fehlermeldungen nach Entfernen der Spalte sem_tree.studip_object_id"
Closes #3014
Merge request studip/studip!2120
Diffstat (limited to 'db/migrations')
| -rw-r--r-- | db/migrations/5.4.14_restore_studip_object_id.php | 24 | ||||
| -rw-r--r-- | db/migrations/5.4.6.1_restore_studip_object_id.php | 26 | ||||
| -rw-r--r-- | db/migrations/5.4.6_tree_changes.php | 8 |
3 files changed, 24 insertions, 34 deletions
diff --git a/db/migrations/5.4.14_restore_studip_object_id.php b/db/migrations/5.4.14_restore_studip_object_id.php new file mode 100644 index 0000000..00bb0c0 --- /dev/null +++ b/db/migrations/5.4.14_restore_studip_object_id.php @@ -0,0 +1,24 @@ +<? + +final class RestoreStudipObjectId extends Migration +{ + + use DatabaseMigrationTrait; + + public function description() + { + return 'Restores the studip_object_id column for sem_tree'; + } + + protected function up() + { + if (!$this->columnExists('sem_tree', 'studip_object_id')) { + // Add database column for sem_tree institute assignments. + DBManager::get()->exec("ALTER TABLE `sem_tree` ADD + `studip_object_id` CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL AFTER `name`"); + // Add index for studip_object_id. + DBManager::get()->exec("ALTER TABLE `sem_tree` ADD INDEX `studip_object_id` (`studip_object_id`)"); + } + } + +} diff --git a/db/migrations/5.4.6.1_restore_studip_object_id.php b/db/migrations/5.4.6.1_restore_studip_object_id.php deleted file mode 100644 index b79b933..0000000 --- a/db/migrations/5.4.6.1_restore_studip_object_id.php +++ /dev/null @@ -1,26 +0,0 @@ -<? - -final class RestoreStudipObjectId extends Migration -{ - - public function description() - { - return 'Restores the studip_object_id column for sem_tree'; - } - - protected function up() - { - // Add database column for sem_tree institute assignments. - DBManager::get()->exec("ALTER TABLE `sem_tree` ADD - `studip_object_id` CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL AFTER `name`"); - // Add index for studip_object_id. - DBManager::get()->exec("ALTER TABLE `sem_tree` ADD INDEX `studip_object_id` (`studip_object_id`)"); - } - - protected function down() - { - // Remove institute assignments for sem_tree entries. - DBManager::get()->exec("ALTER TABLE `sem_tree` DROP `studip_object_id`"); - } - -} diff --git a/db/migrations/5.4.6_tree_changes.php b/db/migrations/5.4.6_tree_changes.php index 146a77a..e71be6e 100644 --- a/db/migrations/5.4.6_tree_changes.php +++ b/db/migrations/5.4.6_tree_changes.php @@ -33,8 +33,6 @@ final class TreeChanges extends Migration foreach (DBManager::get()->fetchAll($query) as $institute) { $stmt->execute(['name' => $institute['Name'], 'inst' => $institute['Institut_id']]); } - // Remove institute assignments for sem_tree entries. - DBManager::get()->exec("ALTER TABLE `sem_tree` DROP `studip_object_id`"); } protected function down() @@ -51,12 +49,6 @@ final class TreeChanges extends Migration UNIX_TIMESTAMP(), UNIX_TIMESTAMP() , 'mit welchem Status darf die Veranstaltungshierarchie bearbeitet werden (admin oder root)' )"); - - // Add database column for sem_tree institute assignments. - DBManager::get()->exec("ALTER TABLE `sem_tree` ADD - `studip_object_id` CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL AFTER `name`"); - // Add index for studip_object_id. - DBManager::get()->exec("ALTER TABLE `sem_tree` ADD INDEX `studip_object_id` (`studip_object_id`)"); } } |
