starting scraper development
This commit is contained in:
24
tables.sql
24
tables.sql
@ -37,7 +37,7 @@ create table picrinth.pictures (
|
||||
id serial not null,
|
||||
source text not null,
|
||||
external_id text not null,
|
||||
url text not null,
|
||||
"url" text not null,
|
||||
metadata jsonb null,
|
||||
created_at timestamp with time zone default now(),
|
||||
constraint pictures_pkey primary key (id),
|
||||
@ -59,7 +59,7 @@ create table picrinth.swipes (
|
||||
username text not null,
|
||||
feed_id integer not null,
|
||||
picture_id integer not null,
|
||||
value smallint not null,
|
||||
"value" smallint not null,
|
||||
created_at timestamp with time zone default now(),
|
||||
primary key (id),
|
||||
foreign key (username) references picrinth.users (username) on delete cascade on update cascade,
|
||||
@ -68,23 +68,15 @@ create table picrinth.swipes (
|
||||
constraint swipes_unique unique (username, feed_id, picture_id)
|
||||
);
|
||||
|
||||
-- TODO: add author?
|
||||
create table picrinth.accounts (
|
||||
id serial not null,
|
||||
groupname text not null,
|
||||
author text null,
|
||||
platform text not null,
|
||||
login text not null,
|
||||
password text not null,
|
||||
"login" text not null,
|
||||
"password" text not null,
|
||||
metadata jsonb null,
|
||||
created_at timestamp with time zone default now(),
|
||||
primary key (id),
|
||||
constraint unique_account_per_platform unique (platform, login)
|
||||
);
|
||||
|
||||
create table picrinth.group_accounts (
|
||||
groupname text not null,
|
||||
account_id int not null,
|
||||
created_at timestamp with time zone default now(),
|
||||
constraint unique_group_accounts unique (account_id, groupname),
|
||||
foreign key (groupname) references picrinth.groups (groupname) on delete cascade on update cascade,
|
||||
foreign key (account_id) references picrinth.accounts (id) on delete cascade on update cascade
|
||||
foreign key (author) references picrinth.groups (author) on delete cascade on update cascade,
|
||||
constraint unique_account_for_group_per_platform unique (groupname, platform)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user