summaryrefslogtreecommitdiff
path: root/hosts/surtr
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/surtr')
-rw-r--r--hosts/surtr/postgresql.nix16
1 files changed, 7 insertions, 9 deletions
diff --git a/hosts/surtr/postgresql.nix b/hosts/surtr/postgresql.nix
index 510437aa..ca56f60c 100644
--- a/hosts/surtr/postgresql.nix
+++ b/hosts/surtr/postgresql.nix
@@ -28,18 +28,16 @@ in {
28 \i ${versioning + "/install.versioning.sql"} 28 \i ${versioning + "/install.versioning.sql"}
29 29
30 BEGIN; 30 BEGIN;
31 select _v.register_patch('000-base', null, null); 31 SELECT _v.register_patch('000-base', null, null);
32 32
33 create table virtual_mailbox ( 33 CREATE TABLE virtual_mailbox (
34 id uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(), 34 id uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
35 local text, 35 local text CONSTRAINT local_non_empty CHECK (local IS DISTINCT FROM '''),
36 CHECK (local IS DISTINCT FROM '''), 36 domain text NOT NULL CONSTRAINT domain_non_empty CHECK (domain <> '''),
37 domain text NOT NULL, 37 mailbox text NOT NULL CONSTRAINT mailbox_non_empty CHECK (mailbox <> '''),
38 CHECK (domain <> '''), 38 CONSTRAINT local_domain_unique UNIQUE (local, domain)
39 mailbox text NOT NULL,
40 CHECK (mailbox <> '''),
41 UNIQUE(COALESCE(local, '''), domain)
42 ); 39 );
40 CREATE UNIQUE INDEX domain_unique ON TABLE virtual_mailbox (domain) WHERE local IS NULL;
43 COMMIT; 41 COMMIT;
44 ''} 42 ''}
45 ''; 43 '';