wip episode actions
This commit is contained in:
parent
7ce41cd034
commit
3e79bec974
16 changed files with 319 additions and 13 deletions
|
|
@ -1,14 +1,17 @@
|
|||
create table users (
|
||||
id integer primary key not null,
|
||||
|
||||
username text unique not null,
|
||||
password_hash text not null
|
||||
);
|
||||
|
||||
create table sessions (
|
||||
id bigint primary key not null,
|
||||
|
||||
user_id bigint not null
|
||||
references users (id)
|
||||
on delete cascade,
|
||||
|
||||
unique (id, user_id)
|
||||
);
|
||||
|
||||
|
|
@ -28,15 +31,24 @@ create table devices (
|
|||
|
||||
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,
|
||||
url text not null,
|
||||
subscription_id bigint not null
|
||||
references subscriptions (id)
|
||||
on delete cascade
|
||||
|
||||
time_changed bigint not null default 0,
|
||||
deleted boolean not null default false,
|
||||
|
||||
unique (device_id, url)
|
||||
unique (device_id, subscription_id)
|
||||
);
|
||||
|
||||
create table episode_actions (
|
||||
|
|
@ -44,14 +56,14 @@ create table episode_actions (
|
|||
|
||||
subscription_id bigint not null
|
||||
references subscriptions (id)
|
||||
on delete cascade,
|
||||
on delete set null,
|
||||
|
||||
-- Can be null, as the device is not always provided
|
||||
device_id bigint
|
||||
references devices (id)
|
||||
on delete set null,
|
||||
|
||||
episode text not null,
|
||||
episode_url text not null,
|
||||
timestamp bigint,
|
||||
action text not null,
|
||||
started integer,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue