@@ -47,18 +47,22 @@ CREATE TABLE channel (
4747 config text , -- JSON with channel-specific attributes
4848 -- for now type determines the implementation, in the future, this will need a reference to a concrete
4949 -- implementation to allow multiple implementations of a sms channel for example, probably even user-provided ones
50+ external_uuid uuid NOT NULL ,
5051
51- CONSTRAINT pk_channel PRIMARY KEY (id)
52+ CONSTRAINT pk_channel PRIMARY KEY (id),
53+ UNIQUE (external_uuid)
5254);
5355
5456CREATE TABLE contact (
5557 id bigserial ,
5658 full_name citext NOT NULL ,
5759 username citext, -- reference to web user
5860 default_channel_id bigint NOT NULL REFERENCES channel(id),
61+ external_uuid uuid NOT NULL ,
5962
6063 CONSTRAINT pk_contact PRIMARY KEY (id),
61- UNIQUE (username)
64+ UNIQUE (username),
65+ UNIQUE (external_uuid)
6266);
6367
6468CREATE TABLE contact_address (
@@ -74,8 +78,10 @@ CREATE TABLE contact_address (
7478CREATE TABLE contactgroup (
7579 id bigserial ,
7680 name citext NOT NULL ,
81+ external_uuid uuid NOT NULL ,
7782
78- CONSTRAINT pk_contactgroup PRIMARY KEY (id)
83+ CONSTRAINT pk_contactgroup PRIMARY KEY (id),
84+ UNIQUE (external_uuid)
7985);
8086
8187CREATE TABLE contactgroup_member (
0 commit comments