aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorSebastian Biller <s.biller@tu-braunschweig.de>2022-01-25 15:52:14 +0000
committerAndré Noack <noack@data-quest.de>2022-01-25 15:52:14 +0000
commit50202028eab9dea122fb1b8bd082b60f45c7152c (patch)
treed6c5ad696adb9187ad7e6198654ea8a2d355949e /db
parent653cfb58ca06423ab8636eab7a224c504d027636 (diff)
fixes #410
Diffstat (limited to 'db')
-rw-r--r--db/migrations/5.1.16_tic_410.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/db/migrations/5.1.16_tic_410.php b/db/migrations/5.1.16_tic_410.php
new file mode 100644
index 0000000..af9774e
--- /dev/null
+++ b/db/migrations/5.1.16_tic_410.php
@@ -0,0 +1,43 @@
+<?php
+class tic410 extends Migration
+{
+ public function description()
+ {
+ return "create NewsRoles table";
+ }
+
+ public function up()
+ {
+ $db = DBManager::get();
+
+ $query = 'CREATE TABLE IF NOT EXISTS `news_roles` (
+ `news_id` CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
+ `roleid` int(10) NOT NULL,
+ PRIMARY KEY (`news_id`, `roleid`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;';
+ $db->exec($query);
+
+ $query = 'ALTER TABLE `news` ADD COLUMN `prio` tinyint(2) NOT NULL DEFAULT 0 AFTER `allow_comments`';
+ $db->exec($query);
+
+ $query = "INSERT IGNORE INTO `config` (`field`, `value`, `type`, `range`, `mkdate`, `chdate`, `description`)
+ VALUES (:name, :value, :type, :range, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)";
+
+ $statement = DBManager::get()->prepare($query);
+ $statement->execute([
+ ':name' => 'NEWS_ONLY_SYSTEM_ROLES',
+ ':description' => 'Über diese Option wird die Auswahl der rollenspezifischen Ankündigungen auf Systemrollen begrenzt',
+ ':range' => 'global',
+ ':type' => 'boolean',
+ ':value' => '1'
+ ]);
+ }
+
+ public function down()
+ {
+ $db = DBManager::get();
+
+ $db->exec('DROP TABLE IF EXISTS `news_roles`');
+ $db->exec('ALTER TABLE `news` DROP COLUMN `prio`');
+ }
+}