From be4c942cb3bd2b41dc2e01eb437dfd4f2f73ab4a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 6 Oct 2019 00:14:19 +0200 Subject: SQL allow recreating existing user (#2555) * SQL allow recreating existing user Taking advantage of https://github.com/FreshRSS/FreshRSS/pull/2554 In a case when FreshRSS data is lost, but database data still intact (in particular MySQL or PostgreSQL), this patch allows recreating previous users without error * Better error retrieval Especially when error occur during the prepare statement --- app/SQL/install.sql.pgsql.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app/SQL/install.sql.pgsql.php') diff --git a/app/SQL/install.sql.pgsql.php b/app/SQL/install.sql.pgsql.php index b37ff9f90..d77fe917b 100644 --- a/app/SQL/install.sql.pgsql.php +++ b/app/SQL/install.sql.pgsql.php @@ -52,6 +52,7 @@ CREATE TABLE IF NOT EXISTS `_entry` ( CREATE INDEX IF NOT EXISTS `_is_favorite_index` ON `_entry` ("is_favorite"); CREATE INDEX IF NOT EXISTS `_is_read_index` ON `_entry` ("is_read"); CREATE INDEX IF NOT EXISTS `_entry_lastSeen_index` ON `_entry` ("lastSeen"); +CREATE INDEX IF NOT EXISTS `_entry_feed_read_index` ON `_entry` ("id_feed","is_read"); -- v1.7 INSERT INTO `_category` (id, name) SELECT 1, 'Uncategorized' @@ -59,6 +60,10 @@ INSERT INTO `_category` (id, name) RETURNING nextval('`_category_id_seq`'); SQL; +const SQL_CREATE_INDEX_ENTRY_1 = <<<'SQL' +CREATE INDEX IF NOT EXISTS `_entry_feed_read_index` ON `_entry` ("id_feed","is_read"); -- v1.7 +SQL; + const SQL_CREATE_TABLE_ENTRYTMP = <<<'SQL' CREATE TABLE IF NOT EXISTS `_entrytmp` ( -- v1.7 "id" BIGINT NOT NULL PRIMARY KEY, @@ -78,9 +83,6 @@ CREATE TABLE IF NOT EXISTS `_entrytmp` ( -- v1.7 UNIQUE ("id_feed","guid") ); CREATE INDEX IF NOT EXISTS `_entrytmp_date_index` ON `_entrytmp` ("date"); - --- v1.7 -CREATE INDEX IF NOT EXISTS `_entry_feed_read_index` ON `_entry` ("id_feed","is_read"); SQL; const SQL_CREATE_TABLE_TAGS = <<<'SQL' -- cgit v1.2.3