75 lines
2.1 KiB
MySQL
75 lines
2.1 KiB
MySQL
|
|
-- @up
|
||
|
|
|
||
|
|
create table chats (
|
||
|
|
id integer primary key,
|
||
|
|
name text not null
|
||
|
|
) strict;
|
||
|
|
|
||
|
|
create table chat_config (
|
||
|
|
chatid integer,
|
||
|
|
timezone text not null default 'America/Denver',
|
||
|
|
cron text not null default 'inherit',
|
||
|
|
scripture_daily text not null default '0 8 * * *',
|
||
|
|
scripture_daily_enable boolean not null default true,
|
||
|
|
birthdays_weekly text not null default '30 7 * * 0',
|
||
|
|
birthdays_weekly_enable boolean not null default true,
|
||
|
|
birthdays_daily text not null default '30 7 * * 1-6',
|
||
|
|
birthdays_daily_enable boolean not null default true,
|
||
|
|
foreign key (chatid) references chats(id)
|
||
|
|
);
|
||
|
|
|
||
|
|
-- Overrides settings.toml.
|
||
|
|
create table system_config (
|
||
|
|
config text,
|
||
|
|
value text,
|
||
|
|
primary key (config)
|
||
|
|
);
|
||
|
|
insert into system_config ('config.sql.enable', 'false');
|
||
|
|
insert into system_config ('service.method', 'webhook');
|
||
|
|
insert into system_config ('service.webhook.uri', 'https://example.com/bot');
|
||
|
|
insert into system_config ('service.webhook.port', '2020');
|
||
|
|
insert into system_config ('service.webhook.host', '::');
|
||
|
|
insert into system_config ('system.timezone', 'America/Denver');
|
||
|
|
insert into system_config ('translations.basedir', 'data/translations');
|
||
|
|
insert into system_config ('translations.active', 'bsb');
|
||
|
|
|
||
|
|
create table users (
|
||
|
|
id integer primary key,
|
||
|
|
username text not null
|
||
|
|
);
|
||
|
|
insert into users (1, 'system');
|
||
|
|
|
||
|
|
create table verses (
|
||
|
|
id integer primary key autoincrement,
|
||
|
|
submitterid integer not null default 1,
|
||
|
|
added text,
|
||
|
|
book text not null,
|
||
|
|
chapter int not null,
|
||
|
|
verse_start int not null,
|
||
|
|
verse_stop int default 0 not null,
|
||
|
|
foreign key (submitterid) references users(id)
|
||
|
|
);
|
||
|
|
|
||
|
|
create table verse_rotation (
|
||
|
|
verseid integer,
|
||
|
|
chatid integer,
|
||
|
|
count integer,
|
||
|
|
|
||
|
|
foreign key (verseid) references verses(id),
|
||
|
|
foreign key (chatid) references chats(id),
|
||
|
|
primary key (verseid, chatid)
|
||
|
|
);
|
||
|
|
|
||
|
|
create table chat_verses (
|
||
|
|
|
||
|
|
);
|
||
|
|
|
||
|
|
-- Enable with PRAGMA foreign_keys = ON;
|
||
|
|
|
||
|
|
create table verse_submitters (
|
||
|
|
verseid integer,
|
||
|
|
userid integer,
|
||
|
|
foreign key (verseid) references verses(id),
|
||
|
|
foreign key (userid) references users(id),
|
||
|
|
primary key (verseid, userid)
|
||
|
|
);
|