-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
22 lines (21 loc) · 941 Bytes
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
create table users (
id bigserial not null,
access_token varchar(255),
mastodon_id bigint,
created_at timestamp not null,
updated_at timestamp not null,
constraint pk_users primary key (id))
;
create unique index idx_users_mastodon_id on users (mastodon_id);
create table snapshots (
id bigserial not null,
owner bigint,
snap_type varchar(16), -- toot or fav
status varchar(16), -- wait, doing, done, fail
bucket varchar(255), -- AWS S3 bucket
key varchar(255), -- AWS S3 key
created_at timestamp not null,
updated_at timestamp not null,
constraint pk_snapshots primary key (id))
;
alter table snapshots add constraint fk_snapshots_owner foreign key (owner) references users (id);