From: CMDR furrycat Date: Wed, 5 Oct 2016 11:09:20 +0000 (+0100) Subject: Enforce U in UUID. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=ee2b0078c10307f30dd13de0c411e896839e027d;p=furrycat%2Fcatbot.git Enforce U in UUID. --- diff --git a/db.py b/db.py index 7e2ade9..01575e0 100644 --- a/db.py +++ b/db.py @@ -31,7 +31,10 @@ class DBConnection(object): def create_tables(self): self.open_db() cursor = self.query('create table if not exists state (id char(36) not null, bot_id varchar(32) not null, avatar varchar(128), idle boolean not null default false, last_spoke datetime)') + cursor = self.query('create unique index if not exists state_id on state (id)') + cursor = self.query('create unique index if not exists state_bot_id on state (bot_id)') cursor = self.query('create table if not exists announcements (id char(36) not null, bot_id varchar(32) not null, server_id varchar(32) not null, member_id varchar(32) not null, channel_id varchar(32) not null, voice_id varchar(32), sound varchar(128), mention varchar(32), start_date datetime, end_date datetime, interval int, probability float not null default 1.0, last_spoke datetime, message text, digest char(56))') + cursor = self.query('create unique index if not exists announcements_id on announcements (id)') self.dbh.commit() self.close_db()