diff --git a/sql/branch.sql b/sql/branch.sql deleted file mode 100644 index 72c605b64..000000000 --- a/sql/branch.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE recipient_settings - ALTER COLUMN patron_visibilities DROP NOT NULL, - ADD COLUMN patron_countries text CHECK (patron_countries <> ''); diff --git a/sql/migrations.sql b/sql/migrations.sql index f1ac20001..282dd1118 100644 --- a/sql/migrations.sql +++ b/sql/migrations.sql @@ -3477,3 +3477,8 @@ UPDATE app_conf SET value = '"https://master.apis.dev.openstreetmap.org/api/0.6" UPDATE app_conf SET value = '"https://master.apis.dev.openstreetmap.org/oauth2/authorize"' WHERE key = 'openstreetmap_auth_url'; UPDATE app_conf SET value = '"xAVaXxy0BwUef4SIo55v7E1ofuC53EN8H-X5232d8Vo"' WHERE key = 'openstreetmap_id'; UPDATE app_conf SET value = '"JtqazsotvWZQ1G6ynYhDlHXouQji-qDwwU2WQW7j-kE"' WHERE key = 'openstreetmap_secret'; + +-- migration #176 +ALTER TABLE recipient_settings + ALTER COLUMN patron_visibilities DROP NOT NULL, + ADD COLUMN patron_countries text CHECK (patron_countries <> ''); diff --git a/sql/schema.sql b/sql/schema.sql index 7eaf6dbde..e52d44652 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -14,7 +14,7 @@ COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQ -- database metadata CREATE TABLE db_meta (key text PRIMARY KEY, value jsonb); -INSERT INTO db_meta (key, value) VALUES ('schema_version', '175'::jsonb); +INSERT INTO db_meta (key, value) VALUES ('schema_version', '176'::jsonb); -- app configuration @@ -173,8 +173,12 @@ CREATE TRIGGER update_profile_visibility CREATE TABLE recipient_settings ( participant bigint PRIMARY KEY REFERENCES participants -, patron_visibilities int NOT NULL CHECK (patron_visibilities > 0) +, patron_visibilities int CHECK (patron_visibilities > 0) -- Three bits: 1 is for "secret", 2 is for "private", 4 is for "public". +, patron_countries text CHECK (patron_countries <> '') +-- A comma (,) separated list of uppercase 3-letter ISO country codes, possibly +-- prefixed with a dash (-) indicating that the listed countries are the ones +-- to exclude rather than the ones to allow. );