X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9b3f8c7252b92a7b32996aa3c2b5e5c16361c82d..3334627402c6bf40e156f9dc7592e941d81b574c:/projects/stargazer/inst/var/02-alter-03.postgresql.sql

diff --git a/projects/stargazer/inst/var/02-alter-03.postgresql.sql b/projects/stargazer/inst/var/02-alter-03.postgresql.sql
new file mode 100644
index 00000000..a686aa68
--- /dev/null
+++ b/projects/stargazer/inst/var/02-alter-03.postgresql.sql
@@ -0,0 +1,13 @@
+/*
+ *  DB migration from v02 to v03 (postgres)
+ */
+BEGIN;
+
+CREATE DOMAIN DM_TARIFF_CHANGE_POLICY AS TEXT NOT NULL
+    CONSTRAINT valid_value CHECK (VALUE IN ('allow', 'to_cheap', 'to_expensive', 'deny'));
+
+ALTER TABLE tb_tariffs ADD change_policy DM_TARIFF_CHANGE_POLICY DEFAULT 'allow';
+
+UPDATE tb_info SET version = 8;
+
+COMMIT;
