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
This commit is contained in:
Alexandre Alapetite
2019-10-05 15:48:25 +02:00
committed by GitHub
parent 77afd1393e
commit 61724c651b
5 changed files with 13 additions and 13 deletions

View File

@@ -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'