From e922f90875de446525cb3e01e929690b3de8c21e Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Wed, 30 Nov 2022 11:57:02 +0000 Subject: [PATCH] add migration that changes the type of resource_property_definitions.type to ENUM, fixes #1796 Closes #1796 Merge request studip/studip!1210 --- ..._of_resource_property_definitions_type.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 db/migrations/5.1.36_change_type_of_resource_property_definitions_type.php diff --git a/db/migrations/5.1.36_change_type_of_resource_property_definitions_type.php b/db/migrations/5.1.36_change_type_of_resource_property_definitions_type.php new file mode 100644 index 00000000000..1af2b45e008 --- /dev/null +++ b/db/migrations/5.1.36_change_type_of_resource_property_definitions_type.php @@ -0,0 +1,22 @@ +<?php +final class ChangeTypeOfResourcePropertyDefinitionsType extends Migration +{ + public function description() + { + return 'Changes the type of resource_property_definitions.type to ENUM'; + } + + protected function up() + { + $query = "ALTER TABLE `resource_property_definitions` + CHANGE COLUMN `type` `type` ENUM('bool', 'text', 'num', 'select', 'user', 'institute', 'position', 'fileref', 'url') COLLATE latin1_bin NOT NULL"; + DBManager::get()->exec($query); + } + + protected function down() + { + $query = "ALTER TABLE `resource_property_definitions` + CHANGE COLUMN `type` `type` SET('bool', 'text', 'num', 'select', 'user', 'institute', 'position', 'fileref', 'url', 'resource_ref_list') COLLATE latin1_bin DEFAULT NULL"; + DBManager::get()->exec($query); + } +} -- GitLab