aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorThomas Hackl <hackl@data-quest.de>2024-10-29 13:42:14 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-10-29 13:42:14 +0000
commit8d6d795330dfa243d53c974815980b1bbfb36778 (patch)
tree2bb2e1d14b977f00d497fd904c76a24d97782a86 /db
parentbb5267288c91778f25e6bee8a76c61a6c61901a6 (diff)
Resolve "Assistent für Roots nach Updates"
Closes #4245 Merge request studip/studip!3348
Diffstat (limited to 'db')
-rw-r--r--db/migrations/6.0.24_root_assistant_configs.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/db/migrations/6.0.24_root_assistant_configs.php b/db/migrations/6.0.24_root_assistant_configs.php
new file mode 100644
index 0000000..24c12f8
--- /dev/null
+++ b/db/migrations/6.0.24_root_assistant_configs.php
@@ -0,0 +1,64 @@
+<?php
+
+final class RootAssistantConfigs extends Migration
+{
+ public function description()
+ {
+ return 'Creates configs for the root-assistant';
+ }
+
+ public function up()
+ {
+ $query = 'INSERT INTO `config` (`field`, `value`, `type`, `section`, `range`, `description`, `mkdate`, `chdate`)
+ VALUES (:name, :value, :type, :section, :range, :description, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())';
+ $statement = DBManager::get()->prepare($query);
+ $statement->execute([
+ 'name' => 'SHOW_RELEASE_NOTES',
+ 'value' => '1',
+ 'type' => 'boolean',
+ 'section' => 'Root-Assistent',
+ 'range' => 'global',
+ 'description' => 'Sollen die Release-Notes für root-User angezeigt werden?'
+ ]);
+ $statement->execute([
+ 'name' => 'UPDATE_NEWS_SEEN',
+ 'value' => '0',
+ 'type' => 'boolean',
+ 'section' => 'Root-Assistent',
+ 'range' => 'global',
+ 'description' => 'Bestätigung, dass die Update-Neuigkeiten gesehen wurden'
+ ]);
+ $statement->execute([
+ 'name' => 'MIGRATION_START_TIME',
+ 'value' => time(),
+ 'type' => 'string',
+ 'section' => 'Root-Assistent',
+ 'range' => 'global',
+ 'description' => 'Speichert die Startzeit (Timestamp) der letzten Migration'
+ ]);
+
+ $statement->execute([
+ 'name' => 'MIGRATION_START_VERSION',
+ 'value' => '5.5',
+ 'type' => 'string',
+ 'section' => 'Root-Assistent',
+ 'range' => 'global',
+ 'description' => 'Speichert die jeweilige Stud.IP-Version beim Start der Migration'
+ ]);
+
+ }
+
+ public function down()
+ {
+ $query = "DELETE `config`, `config_values`
+ FROM `config`
+ LEFT JOIN `config_values` USING (`field`)
+ WHERE `field` IN (
+ 'MIGRATION_START_TIME',
+ 'MIGRATION_START_VERSION',
+ 'SHOW_RELEASE_NOTES',
+ 'UPDATE_NEWS_SEEN'
+ )";
+ DBManager::get()->exec($query);
+ }
+}