X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6fea72fd20cb3c2f7d0203b50b5e200ca4a930bf..19b1d5971c25819b3ccfe48cac16ff4e2daa6ec4:/projects/stargazer/inst/var/01-alter-02.postgresql.sql

diff --git a/projects/stargazer/inst/var/01-alter-02.postgresql.sql b/projects/stargazer/inst/var/01-alter-02.postgresql.sql
new file mode 100644
index 00000000..ef6a98c6
--- /dev/null
+++ b/projects/stargazer/inst/var/01-alter-02.postgresql.sql
@@ -0,0 +1,13 @@
+/*
+ *  DB migration from v01 to v02 (postgres)
+ */
+BEGIN;
+
+CREATE DOMAIN DM_TARIFF_PERIOD AS TEXT NOT NULL
+    CONSTRAINT valid_value CHECK (VALUE = 'month' OR VALUE = 'day');
+
+ALTER TABLE tb_tariffs ADD period DM_TARIFF_PERIOD DEFAULT 'month';
+
+UPDATE tb_info SET version = 7;
+
+COMMIT;
