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 0000000000000000000000000000000000000000..00bb0c0b22473ab18472089001e3084bde2fecbd --- /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 b79b93344c5b45aeb322102234b60591764a3fbd..0000000000000000000000000000000000000000 --- 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 146a77ae643908ff03cbc000b42ba756edb5c9f8..e71be6e29c4a6f4f44ff74224b52e88693e42041 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`)"); } }