Encapsulate SQL statements and refactor Save functions as transactionable.

This commit is contained in:
Jeremy Latt 2013-05-24 21:39:53 -07:00
parent f24bb5ee7d
commit 48ca57c43d
11 changed files with 347 additions and 12 deletions

10
sql/init.sql Normal file
View file

@ -0,0 +1,10 @@
CREATE TABLE user (id integer not null primary key autoincrement, nick text not null, hash blob not null)
CREATE UNIQUE INDEX user_id ON user (id)
CREATE UNIQUE INDEX user_nick ON user (nick)
CREATE TABLE channel (id integer not null primary key autoincrement, name text not null)
CREATE UNIQUE INDEX channel_id ON channel (id)
CREATE UNIQUE INDEX channel_name ON channel (name)
CREATE_TABLE user_channel (id integer not null primary key autoincrement, user_id integer not null, channel_id integer not null)
CREATE UNIQUE INDEX user_id_channel_id ON user_channel (user_id, channel_id)