refactor: decide to not create separate table for subscriptions

This commit is contained in:
Jef Roosens 2025-03-04 08:46:49 +01:00
parent 3e79bec974
commit 064365fb4f
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
7 changed files with 119 additions and 129 deletions

View file

@ -29,41 +29,32 @@ create table devices (
unique (user_id, device_id)
);
create table subscriptions (
id integer primary key not null,
url text unique not null
);
create table device_subscriptions (
id integer primary key not null,
device_id bigint not null
references devices (id)
on delete cascade,
subscription_id bigint not null
references subscriptions (id)
on delete cascade
podcast_url text not null,
time_changed bigint not null default 0,
deleted boolean not null default false,
unique (device_id, subscription_id)
unique (device_id, podcast_url)
);
create table episode_actions (
id integer primary key not null,
subscription_id bigint not null
references subscriptions (id)
on delete set null,
-- Can be null, as the device is not always provided
device_id bigint
references devices (id)
on delete set null,
podcast_url text not null,
episode_url text not null,
timestamp bigint,
action text not null,
started integer,