Skip to content
Snippets Groups Projects
Commit faa7fb47 authored by Thomas Hackl's avatar Thomas Hackl Committed by Jan-Hendrik Willms
Browse files

Resolve "Fehlermeldungen nach Entfernen der Spalte sem_tree.studip_object_id"

Closes #3014

Merge request studip/studip!2120
parent ef1bd917
No related branches found
No related tags found
No related merge requests found
<?
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`)");
}
}
}
<?
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`");
}
}
...@@ -33,8 +33,6 @@ final class TreeChanges extends Migration ...@@ -33,8 +33,6 @@ final class TreeChanges extends Migration
foreach (DBManager::get()->fetchAll($query) as $institute) { foreach (DBManager::get()->fetchAll($query) as $institute) {
$stmt->execute(['name' => $institute['Name'], 'inst' => $institute['Institut_id']]); $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() protected function down()
...@@ -51,12 +49,6 @@ final class TreeChanges extends Migration ...@@ -51,12 +49,6 @@ final class TreeChanges extends Migration
UNIX_TIMESTAMP(), UNIX_TIMESTAMP() , UNIX_TIMESTAMP(), UNIX_TIMESTAMP() ,
'mit welchem Status darf die Veranstaltungshierarchie bearbeitet werden (admin oder root)' '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`)");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment