Moved v0003 migrations into base.
This commit is contained in:
parent
e53f21e814
commit
84e624a91b
2 changed files with 33 additions and 33 deletions
|
|
@ -1,10 +0,0 @@
|
|||
-- @up
|
||||
|
||||
alter table birthdays add column announce boolean default true not null;
|
||||
|
||||
-- Anniversaries will be re-added in the future, either as a base table for
|
||||
-- wedding anniversaries + birthdays or as a single purpose table. If the
|
||||
-- former, anniversary types will be implemented as views, and the INSTEAD OF
|
||||
-- trigger will be used for inserts and updates:
|
||||
-- www.sqlite.org/lang_createtrigger.html#instead_of_trigger
|
||||
drop table anniversaries;
|
||||
|
|
@ -1,5 +1,28 @@
|
|||
-- @up
|
||||
-- @version=0002
|
||||
-- @version=0003
|
||||
|
||||
-- Chats.
|
||||
--
|
||||
-- Several tables are dependent upon chats.id so it's created first.
|
||||
|
||||
create table chats (
|
||||
id integer primary key,
|
||||
name text not null
|
||||
) strict;
|
||||
insert into chats values (1, 'all chats');
|
||||
|
||||
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)
|
||||
);
|
||||
|
||||
-- Members and member metadata.
|
||||
|
||||
|
|
@ -14,11 +37,18 @@ create index anniversaries_month_day_idx on anniversaries (month, day);
|
|||
|
||||
create table announcements (
|
||||
id integer primary key autoincrement,
|
||||
chatid integer not null,
|
||||
scheduled_for datetime not null,
|
||||
|
||||
-- If enabled, reminders will be generated a week before and a day before the announcement itself.
|
||||
reminders boolean default true not null,
|
||||
title text default '' not null,
|
||||
content text default '' not null
|
||||
content text default '' not null,
|
||||
|
||||
foreign key (chatid) references chats(id)
|
||||
);
|
||||
create index announcements_chatid_idx on announcements (chatid);
|
||||
create index announcements_scheduled_for_idx on announcements (scheduled_for);
|
||||
|
||||
create table birthdays (
|
||||
id integer primary key autoincrement,
|
||||
|
|
@ -39,6 +69,7 @@ create table birthdays (
|
|||
-- (March 1st). 0 = no delta (non-leap day) or no preference (no preference
|
||||
-- is handled the same as -1).
|
||||
leap_delta integer not null check (leap_delta >= -1 or leap_delta <= 1),
|
||||
announce boolean default true not null,
|
||||
|
||||
foreign key (userid) references users(id),
|
||||
foreign key (chatid) references chats(id)
|
||||
|
|
@ -46,27 +77,6 @@ create table birthdays (
|
|||
create index birthdays_chatid_idx on birthdays (chatid);
|
||||
create index birthdays_chatid_name_idx on birthdays (chatid, name);
|
||||
|
||||
-- Chats.
|
||||
|
||||
create table chats (
|
||||
id integer primary key,
|
||||
name text not null
|
||||
) strict;
|
||||
insert into chats values (1, 'all chats');
|
||||
|
||||
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)
|
||||
);
|
||||
|
||||
-- System
|
||||
|
||||
-- Overrides settings.toml.
|
||||
|
|
|
|||
Loading…
Reference in a new issue