Table updates.

This commit is contained in:
Benjamin A. Shelton 2026-10-15 14:33:47 -06:00
commit bf6fb1f685
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -96,25 +96,27 @@ create table verses_submitter (
primary key (verseid, chatid, submitterid)
);
-- Verses added to the rotation will slowly atrophy the number available in
-- `verses`. Clients should delete entries from this table once the intersection
-- of verses available and verses loaded here fully coincide.
create table verse_rotation (
verseid integer,
chatid integer,
-- Indicaes how many times this verse has been used in the rotation. As
-- verses are used in any given chat, their count is incremented. Only those
-- verses with a count < MAX(count) are considered for the random rotation
-- until no more verses are found.
count integer default 0 not null,
-- Votes indicates how many times a given verse has been submitted by users
-- in the channel. This counter is only increments if the user and verse
-- identifiers are not present in `verse_votes`. The system user cannot
-- increment this value.
votes integer default 0 not null,
foreign key (verseid) references verses(id),
foreign key (chatid) references chats(id)
);
create unique index verse_rotation_verseid_chatid_idx on verse_rotation (verseid, chatid);
create table verse_log (
verseid integer not null,
chatid integer not null,
posted datetime default current_timestamp not null,
foreign key (verseid) references verses(id),
foreign key (chatid) references chat(id)
);
create index verse_log_verseid_chatid_idx on verse_log (verseid, chatid);
create index verse_log_posted_idx on verse_log (posted);
create table verse_votes (
userid integer,
@ -167,19 +169,6 @@ create table scheduled_verses (
primary key (verseid, chatid, translationid)
);
create table verses_log (
verseid integer not null,
chatid integer not null,
translationid integer not null,
posted datetime default current_timestamp not null,
foreign key (verseid) references verses(id),
foreign key (chatid) references chat(id),
foreign key (translationid) references translations(id),
primary key (verseid, chatid, translationid)
);
create table birthdays (
userid integer not null,
chatid integer not null,