Add UNIQUE constraint for alias on servers table

This commit is contained in:
jesopo 2019-04-24 11:49:54 +01:00
parent 032f6fbc3b
commit bd4fdfdc7b

View file

@ -346,7 +346,8 @@ class Database(object):
self.execute("""CREATE TABLE servers self.execute("""CREATE TABLE servers
(server_id INTEGER PRIMARY KEY, alias TEXT, hostname TEXT, (server_id INTEGER PRIMARY KEY, alias TEXT, hostname TEXT,
port INTEGER, password TEXT, ipv4 BOOLEAN, tls BOOLEAN, port INTEGER, password TEXT, ipv4 BOOLEAN, tls BOOLEAN,
bindhost TEXT, nickname TEXT, username TEXT, realname TEXT)""") bindhost TEXT, nickname TEXT, username TEXT, realname TEXT,
UNIQUE (alias))""")
def make_channels_table(self): def make_channels_table(self):
if not self.has_table("channels"): if not self.has_table("channels"):
self.execute("""CREATE TABLE channels self.execute("""CREATE TABLE channels