From 7f38369935673b9d83893243f303cbcb39f2eb6f Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 27 Dec 2024 13:36:54 -0500 Subject: [PATCH] Address problem with MySQL 9 --- sql/MySQL/0.sql | 24 ++++++++++++------------ sql/MySQL/1.sql | 10 +++++----- sql/MySQL/4.sql | 8 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sql/MySQL/0.sql b/sql/MySQL/0.sql index 3901ad74..b9ff3fad 100644 --- a/sql/MySQL/0.sql +++ b/sql/MySQL/0.sql @@ -20,7 +20,7 @@ create table arsse_users( ) character set utf8mb4; create table arsse_users_meta( - owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade, + owner varchar(255) not null, "key" varchar(255) not null, value varchar(255), primary key(owner,"key") @@ -28,8 +28,8 @@ create table arsse_users_meta( 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, + owner varchar(255) not null, + parent bigint, name varchar(255) not null, modified datetime(0) not null default CURRENT_TIMESTAMP, -- unique(owner,name,parent) @@ -57,20 +57,20 @@ create table arsse_feeds( 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, + owner varchar(255) not null, + feed bigint not null, 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, + folder bigint, unique(owner,feed) ) character set utf8mb4; create table arsse_articles( id serial primary key, - feed bigint not null references arsse_feeds(id) on delete cascade, + feed bigint not null, url varchar(255), title varchar(255), author varchar(255), @@ -85,14 +85,14 @@ create table arsse_articles( ) character set utf8mb4; create table arsse_enclosures( - article bigint not null references arsse_articles(id) on delete cascade, + article bigint not null, url varchar(255), type varchar(255) ) character set utf8mb4; 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, + article bigint not null, + subscription bigint not null, "read" boolean not null default 0, starred boolean not null default 0, modified datetime(0) not null default CURRENT_TIMESTAMP, @@ -101,12 +101,12 @@ create table arsse_marks( create table arsse_editions( id serial primary key, - article bigint not null references arsse_articles(id) on delete cascade, + article bigint not null, modified datetime(0) not null default CURRENT_TIMESTAMP ) character set utf8mb4; create table arsse_categories( - article bigint not null references arsse_articles(id) on delete cascade, + article bigint not null, name varchar(255) ) character set utf8mb4; diff --git a/sql/MySQL/1.sql b/sql/MySQL/1.sql index f7a85425..1e071417 100644 --- a/sql/MySQL/1.sql +++ b/sql/MySQL/1.sql @@ -8,21 +8,21 @@ 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 + "user" varchar(255) not null ) character set utf8mb4; create table arsse_labels ( id serial primary key, - owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade, + owner varchar(255) not null, name varchar(255) not null, modified datetime(0) not null default CURRENT_TIMESTAMP, unique(owner,name) ) character set utf8mb4; 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, + label bigint not null, + article bigint not null, + subscription bigint not null, assigned boolean not null default 1, modified datetime(0) not null default CURRENT_TIMESTAMP, primary key(label,article) diff --git a/sql/MySQL/4.sql b/sql/MySQL/4.sql index bde12122..99c3c881 100644 --- a/sql/MySQL/4.sql +++ b/sql/MySQL/4.sql @@ -6,15 +6,15 @@ create table arsse_tags( id serial primary key, - owner varchar(255) not null references arsse_users(id) on delete cascade on update cascade, + owner varchar(255) not null, name varchar(255) not null, modified datetime(0) not null default CURRENT_TIMESTAMP, unique(owner,name) ) character set utf8mb4 collate utf8mb4_unicode_ci; 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, + tag bigint not null, + subscription bigint not null, assigned boolean not null default 1, modified datetime(0) not null default CURRENT_TIMESTAMP, primary key(tag,subscription) @@ -23,7 +23,7 @@ create table arsse_tag_members( create table arsse_tokens( id varchar(255) not null, class varchar(255) not null, - "user" varchar(255) not null references arsse_users(id) on delete cascade on update cascade, + "user" varchar(255) not null, created datetime(0) not null default CURRENT_TIMESTAMP, expires datetime(0), primary key(id,class)