Files
omnibot22/data/markov/db.sql
2022-06-23 14:34:23 -07:00

19 lines
590 B
SQL

CREATE TABLE IF NOT EXISTS user (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
nick varchar(255) NOT NULL,
channel varchar(255) NOT NULL,
reply_chance real NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS user_nick_channel ON user(nick, channel);
CREATE TABLE IF NOT EXISTS chain (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
user integer NOT NULL,
value text NOT NULL,
weight integer NOT NULL DEFAULT 1,
next text NOT NULL,
FOREIGN KEY(user) REFERENCES user(id)
);
CREATE UNIQUE INDEX IF NOT EXISTS chain_value_next ON chain(user, value, next);