From a9381fe8b251135df9ade8b0078ca3fb6c88d821 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 5 May 2022 19:45:01 +0200 Subject: ... --- hosts/surtr/postgresql.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hosts/surtr') diff --git a/hosts/surtr/postgresql.nix b/hosts/surtr/postgresql.nix index 20cebdea..5773ef97 100644 --- a/hosts/surtr/postgresql.nix +++ b/hosts/surtr/postgresql.nix @@ -43,7 +43,7 @@ in { mailbox uuid REFERENCES mailbox(id), CONSTRAINT local_domain_unique UNIQUE (local, domain) ); - CREATE UNIQUE INDEX domain_unique ON virtual_mailbox_mapping (domain) WHERE local IS NULL; + CREATE UNIQUE INDEX domain_unique ON mailbox_mapping (domain) WHERE local IS NULL; CREATE VIEW virtual_mailbox_domain (domain) AS SELECT DISTINCT domain FROM virtual_mailbox_mapping; CREATE VIEW virtual_mailbox_mapping (mailbox, lookup) AS SELECT mailbox.mailbox as mailbox, (CASE WHEN local IS NULL THEN ''' ELSE local END) || '@' || domain AS lookup FROM mailbox_mapping INNER JOIN mailbox on mailbox.id = mailbox_mapping.mailbox; -- cgit v1.2.3