schema: add UNIQUE constraints

This commit is contained in:
Simon Ser 2020-03-12 15:33:49 +01:00
parent c732b82976
commit 2dfbbf18fd
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -10,12 +10,14 @@ CREATE TABLE Network (
nick VARCHAR(255) NOT NULL,
username VARCHAR(255),
realname VARCHAR(255),
FOREIGN KEY(user) REFERENCES User(username)
FOREIGN KEY(user) REFERENCES User(username),
UNIQUE(user, addr, nick)
);
CREATE TABLE Channel (
id INTEGER PRIMARY KEY,
network INTEGER NOT NULL,
name VARCHAR(255) NOT NULL,
FOREIGN KEY(network) REFERENCES Network(id)
FOREIGN KEY(network) REFERENCES Network(id),
UNIQUE(network, name)
);