diff options
Diffstat (limited to 'schema/pgsql-migrations/upgrade_186.sql')
-rw-r--r-- | schema/pgsql-migrations/upgrade_186.sql | 11 |
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()); |