1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 08:54:52 +00:00
Arsse/sql/PostgreSQL/4.sql
J. King 38bdde1167 Add access tokens to the db, with relevant code
Tokens are similar to sessions in that they stand in for users, but the
protocol handlers will manage them; Fever login hashes are the
originating use case for them. These must never expire, for example,
and we need to specify their values.

This commit also performs a bit of database clean-up
2019-03-09 16:23:56 -05:00

40 lines
1.4 KiB
SQL

-- SPDX-License-Identifier: MIT
-- Copyright 2017 J. King, Dustin Wilson et al.
-- See LICENSE and AUTHORS files for details
-- Please consult the SQLite 3 schemata for commented version
create table arsse_tags(
id bigserial primary key,
owner text not null references arsse_users(id) on delete cascade on update cascade,
name text not null collate "und-x-icu",
modified timestamp(0) without time zone not null default CURRENT_TIMESTAMP,
unique(owner,name)
);
create table arsse_tag_members(
tag bigint not null references arsse_tags(id) on delete cascade,
subscription bigint not null references arsse_subscriptions(id) on delete cascade,
assigned smallint not null default 1,
modified timestamp(0) without time zone not null default CURRENT_TIMESTAMP,
primary key(tag,subscription)
);
create table arsse_tokens(
id text,
class text not null,
"user" text not null references arsse_users(id) on delete cascade on update cascade,
created timestamp(0) without time zone not null default CURRENT_TIMESTAMP,
expires timestamp(0) without time zone,
primary key(id,class)
);
alter table arsse_users drop column name;
alter table arsse_users drop column avatar_type;
alter table arsse_users drop column avatar_data;
alter table arsse_users drop column admin;
alter table arsse_users drop column rights;
drop table arsse_users_meta;
update arsse_meta set value = '5' where "key" = 'schema_version';