mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Base MySQL schema
Note the columns "key" and "read" must be quoted in addition to "user".
This commit is contained in:
parent
c63d24e125
commit
0f7baf4b51
2 changed files with 146 additions and 0 deletions
113
sql/MySQL/0.sql
Normal file
113
sql/MySQL/0.sql
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
-- 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_meta(
|
||||||
|
`key` varchar(255) primary key,
|
||||||
|
value longtext
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_users(
|
||||||
|
id varchar(255) primary key,
|
||||||
|
password varchar(255),
|
||||||
|
name varchar(255),
|
||||||
|
avatar_type varchar(255),
|
||||||
|
avatar_data longblob,
|
||||||
|
admin boolean default 0,
|
||||||
|
rights bigint not null default 0
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_users_meta(
|
||||||
|
owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade,
|
||||||
|
`key` varchar(255) not null,
|
||||||
|
value varchar(255),
|
||||||
|
primary key(owner,`key`)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_folders(
|
||||||
|
id serial primary key,
|
||||||
|
owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade,
|
||||||
|
parent bigint references arsse_folders(id) on delete cascade,
|
||||||
|
name varchar(255) not null,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP, --
|
||||||
|
unique(owner,name,parent)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_feeds(
|
||||||
|
id serial primary key,
|
||||||
|
url varchar(255) not null,
|
||||||
|
title varchar(255),
|
||||||
|
favicon varchar(255),
|
||||||
|
source varchar(255),
|
||||||
|
updated datetime(0),
|
||||||
|
modified datetime(0),
|
||||||
|
next_fetch datetime(0),
|
||||||
|
orphaned datetime(0),
|
||||||
|
etag varchar(255) not null default '',
|
||||||
|
err_count bigint not null default 0,
|
||||||
|
err_msg varchar(255),
|
||||||
|
username varchar(255) not null default '',
|
||||||
|
password varchar(255) not null default '',
|
||||||
|
size bigint not null default 0,
|
||||||
|
scrape boolean not null default 0,
|
||||||
|
unique(url,username,password)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_subscriptions(
|
||||||
|
id serial primary key,
|
||||||
|
owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade,
|
||||||
|
feed bigint not null references arsse_feeds(id) on delete cascade,
|
||||||
|
added datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
title varchar(255),
|
||||||
|
order_type boolean not null default 0,
|
||||||
|
pinned boolean not null default 0,
|
||||||
|
folder bigint references arsse_folders(id) on delete cascade,
|
||||||
|
unique(owner,feed)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_articles(
|
||||||
|
id serial primary key,
|
||||||
|
feed bigint not null references arsse_feeds(id) on delete cascade,
|
||||||
|
url varchar(255),
|
||||||
|
title varchar(255),
|
||||||
|
author varchar(255),
|
||||||
|
published datetime(0),
|
||||||
|
edited datetime(0),
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
content longtext,
|
||||||
|
guid varchar(255),
|
||||||
|
url_title_hash varchar(255) not null,
|
||||||
|
url_content_hash varchar(255) not null,
|
||||||
|
title_content_hash varchar(255) not null
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_enclosures(
|
||||||
|
article bigint not null references arsse_articles(id) on delete cascade,
|
||||||
|
url varchar(255),
|
||||||
|
type varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_marks(
|
||||||
|
article bigint not null references arsse_articles(id) on delete cascade,
|
||||||
|
subscription bigint not null references arsse_subscriptions(id) on delete cascade on update cascade,
|
||||||
|
`read` boolean not null default 0,
|
||||||
|
starred boolean not null default 0,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
primary key(article,subscription)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_editions(
|
||||||
|
id serial primary key,
|
||||||
|
article bigint not null references arsse_articles(id) on delete cascade,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_categories(
|
||||||
|
article bigint not null references arsse_articles(id) on delete cascade,
|
||||||
|
name varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into arsse_meta(`key`,value) values('schema_version','1');
|
33
sql/MySQL/1.sql
Normal file
33
sql/MySQL/1.sql
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
-- 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_sessions (
|
||||||
|
id varchar(255) primary key,
|
||||||
|
created datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
expires datetime(0) not null,
|
||||||
|
`user` varchar(255) not null references arsse_users(id) on delete cascade on update cascade
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_labels (
|
||||||
|
id serial primary key,
|
||||||
|
owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade,
|
||||||
|
name varchar(255) not null,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
unique(owner,name)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table arsse_label_members (
|
||||||
|
label bigint not null references arsse_labels(id) on delete cascade,
|
||||||
|
article bigint not null references arsse_articles(id) on delete cascade,
|
||||||
|
subscription bigint not null references arsse_subscriptions(id) on delete cascade,
|
||||||
|
assigned boolean not null default 1,
|
||||||
|
modified datetime(0) not null default CURRENT_TIMESTAMP,
|
||||||
|
primary key(label,article)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table arsse_marks add column note longtext not null default '';
|
||||||
|
|
||||||
|
update arsse_meta set value = '2' where `key` = 'schema_version';
|
Loading…
Reference in a new issue