aboutsummaryrefslogtreecommitdiff
path: root/app/SQL
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-10-05 15:48:25 +0200
committerGravatar GitHub <noreply@github.com> 2019-10-05 15:48:25 +0200
commit61724c651b18934690b2102537e0a5f7ab4284e4 (patch)
treed399c3ad5e9341c40fda43d87232f80978ce528a /app/SQL
parent77afd1393e461a20d6d04c07dea0756e792636d5 (diff)
PostgreSQL 9.5+ (#2554)
Needed for `CREATE INDEX IF NOT EXISTS` syntax. Supported as back as Ubuntu 16.04 LTS. Similar version checks than for the PHP version bump https://github.com/FreshRSS/FreshRSS/pull/2495 https://www.postgresql.org/docs/9.5/sql-createindex.html https://www.postgresql.org/docs/9.5/release-9-5.html
Diffstat (limited to 'app/SQL')
-rw-r--r--app/SQL/install.sql.pgsql.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/SQL/install.sql.pgsql.php b/app/SQL/install.sql.pgsql.php
index dfacc38e7..b37ff9f90 100644
--- a/app/SQL/install.sql.pgsql.php
+++ b/app/SQL/install.sql.pgsql.php
@@ -28,9 +28,9 @@ CREATE TABLE IF NOT EXISTS `_feed` (
"cache_nbUnreads" INT DEFAULT 0,
FOREIGN KEY ("category") REFERENCES `_category` ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-CREATE INDEX `_name_index` ON `_feed` ("name");
-CREATE INDEX `_priority_index` ON `_feed` ("priority");
-CREATE INDEX `_keep_history_index` ON `_feed` ("keep_history");
+CREATE INDEX IF NOT EXISTS `_name_index` ON `_feed` ("name");
+CREATE INDEX IF NOT EXISTS `_priority_index` ON `_feed` ("priority");
+CREATE INDEX IF NOT EXISTS `_keep_history_index` ON `_feed` ("keep_history");
CREATE TABLE IF NOT EXISTS `_entry` (
"id" BIGINT NOT NULL PRIMARY KEY,
@@ -49,9 +49,9 @@ CREATE TABLE IF NOT EXISTS `_entry` (
FOREIGN KEY ("id_feed") REFERENCES `_feed` ("id") ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE ("id_feed","guid")
);
-CREATE INDEX `_is_favorite_index` ON `_entry` ("is_favorite");
-CREATE INDEX `_is_read_index` ON `_entry` ("is_read");
-CREATE INDEX `_entry_lastSeen_index` ON `_entry` ("lastSeen");
+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");
INSERT INTO `_category` (id, name)
SELECT 1, 'Uncategorized'
@@ -77,10 +77,10 @@ CREATE TABLE IF NOT EXISTS `_entrytmp` ( -- v1.7
FOREIGN KEY ("id_feed") REFERENCES `_feed` ("id") ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE ("id_feed","guid")
);
-CREATE INDEX `_entrytmp_date_index` ON `_entrytmp` ("date");
+CREATE INDEX IF NOT EXISTS `_entrytmp_date_index` ON `_entrytmp` ("date");
-- v1.7
-CREATE INDEX `_entry_feed_read_index` ON `_entry` ("id_feed","is_read");
+CREATE INDEX IF NOT EXISTS `_entry_feed_read_index` ON `_entry` ("id_feed","is_read");
SQL;
const SQL_CREATE_TABLE_TAGS = <<<'SQL'
@@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `_entrytag` (
FOREIGN KEY ("id_tag") REFERENCES `_tag` ("id") ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY ("id_entry") REFERENCES `_entry` ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-CREATE INDEX `_entrytag_id_entry_index` ON `_entrytag` ("id_entry");
+CREATE INDEX IF NOT EXISTS `_entrytag_id_entry_index` ON `_entrytag` ("id_entry");
SQL;
const SQL_INSERT_FEED = <<<'SQL'