justusbot/migrations/sqlite/0003_table_updates.sql

26 lines
No EOL
1 KiB
SQL

-- @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;
drop table announcements;
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,
foreign key (chatid) references chats(id)
);
create index announcements_chatid_idx on announcements (chatid);
create index announcements_scheduled_for_idx on announcements (scheduled_for);