From f4b08170bfdb9458a3441df5de9223b2627d4cb1 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 2 Dec 2019 16:38:41 -0500 Subject: [PATCH] Fix MySQL schema --- sql/MySQL/5.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/MySQL/5.sql b/sql/MySQL/5.sql index 2fe87f34..6d3defe5 100644 --- a/sql/MySQL/5.sql +++ b/sql/MySQL/5.sql @@ -9,9 +9,10 @@ alter table arsse_sessions default character set utf8mb4 collate utf8mb4_unicode alter table arsse_sessions convert to character set utf8mb4 collate utf8mb4_unicode_ci; -- Ensure referential integrity -delete from arsse_folders where - owner not in (select id from arsse_users) or - (parent is not null and parent not in (select id from arsse_folders)); +with valid as (select id from arsse_folders) + delete from arsse_folders where + owner not in (select id from arsse_users) or + (parent is not null and parent not in (select id from valid)); delete from arsse_subscriptions where owner not in (select id from arsse_users) or feed not in (select id from arsse_feeds) or