feat: premium ID changes
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled
Build and push Rust service Docker images / rust docker build (push) Has been cancelled
rust checks / cargo fmt (push) Has been cancelled

This commit is contained in:
Iris System 2025-12-28 00:06:51 +13:00
parent 84e98450e0
commit def9285250
19 changed files with 364 additions and 5 deletions

View file

@ -24,4 +24,4 @@ create table dash_views (
unique (system, name)
);
update info set schema_version = 55;
update info set schema_version = 55;

View file

@ -0,0 +1,23 @@
-- database version 56
-- add premium allowances / hid changelog
create table premium_allowances (
id serial primary key,
system integer references systems (id) on delete set null,
id_changes_remaining int not null default 0 check (id_changes_remaining >= 0),
unique (system)
);
create table hid_changelog (
id serial primary key,
system integer references systems (id) on delete set null,
discord_uid bigint not null,
hid_type text not null,
hid_old char(6) not null,
hid_new char(6) not null,
created timestamp not null default (current_timestamp at time zone 'utc')
);
create index hid_changelog_system_idx on hid_changelog (system);
update info set schema_version = 56;

View file

@ -3,7 +3,8 @@ create table premium_subscriptions (
provider text not null,
provider_id text not null,
email text not null,
system_id int references systems(id) on delete set null,
system_id int references systems (id) on delete set null,
allowance_id int references premium_allowances (id) on delete set null,
status text,
next_renewal_at text,
unique (provider, provider_id)