summaryrefslogtreecommitdiffstats
path: root/schema/pgsql-migrations/upgrade_186.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:17:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:17:47 +0000
commit5419d4428c86c488a43124f85e5407d7cbae6541 (patch)
tree772c4221a20fd7d1b3e7e67c6e21755a50e80fd7 /schema/pgsql-migrations/upgrade_186.sql
parentAdding upstream version 1.10.2. (diff)
downloadicingaweb2-module-director-upstream.tar.xz
icingaweb2-module-director-upstream.zip
Adding upstream version 1.11.1.upstream/1.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'schema/pgsql-migrations/upgrade_186.sql')
-rw-r--r--schema/pgsql-migrations/upgrade_186.sql11
1 files changed, 11 insertions, 0 deletions
diff --git a/schema/pgsql-migrations/upgrade_186.sql b/schema/pgsql-migrations/upgrade_186.sql
new file mode 100644
index 0000000..cb491f6
--- /dev/null
+++ b/schema/pgsql-migrations/upgrade_186.sql
@@ -0,0 +1,11 @@
+ALTER TABLE director_datafield ADD COLUMN uuid bytea UNIQUE CHECK(LENGTH(uuid) = 16);
+UPDATE director_datafield SET uuid = decode(replace(gen_random_uuid()::text, '-', ''), 'hex') WHERE uuid IS NULL;
+ALTER TABLE director_datafield ALTER COLUMN uuid SET NOT NULL;
+
+ALTER TABLE director_datalist ADD COLUMN uuid bytea UNIQUE CHECK(LENGTH(uuid) = 16);
+UPDATE director_datalist SET uuid = decode(replace(gen_random_uuid()::text, '-', ''), 'hex') WHERE uuid IS NULL;
+ALTER TABLE director_datalist ALTER COLUMN uuid SET NOT NULL;
+
+INSERT INTO director_schema_migration
+(schema_version, migration_time)
+VALUES (186, NOW());