aboutsummaryrefslogtreecommitdiff
path: root/app/SQL
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-01 09:24:46 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-10-01 09:24:46 +0200
commitc16a973d453078a037a2a6a6e8e3d17ffd3bf2e6 (patch)
treedbb2b6159d879112d2605b79afd699473813f6d0 /app/SQL
parentc35111fe53ba2081abc735cb61e83987ade5ce86 (diff)
PostgreSQL schema update
Diffstat (limited to 'app/SQL')
-rw-r--r--app/SQL/install.sql.pgsql.php12
1 files changed, 3 insertions, 9 deletions
diff --git a/app/SQL/install.sql.pgsql.php b/app/SQL/install.sql.pgsql.php
index 04e35af68..c2c32ef59 100644
--- a/app/SQL/install.sql.pgsql.php
+++ b/app/SQL/install.sql.pgsql.php
@@ -24,7 +24,7 @@ $SQL_CREATE_TABLES = array(
"ttl" INT NOT NULL DEFAULT -2,
"cache_nbEntries" int DEFAULT 0,
"cache_nbUnreads" int DEFAULT 0,
- FOREIGN KEY (category) REFERENCES "%1$scategory" ("id") ON DELETE SET NULL ON UPDATE CASCADE
+ FOREIGN KEY ("category") REFERENCES "%1$scategory" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);',
'CREATE INDEX name_index ON "%1$sfeed" ("name");',
'CREATE INDEX priority_index ON "%1$sfeed" ("priority");',
@@ -44,19 +44,13 @@ $SQL_CREATE_TABLES = array(
"is_favorite" smallint NOT NULL DEFAULT 0,
"id_feed" SMALLINT,
"tags" varchar(1023),
- FOREIGN KEY (id_feed) REFERENCES "%1$sfeed" (id) ON DELETE CASCADE ON UPDATE CASCADE
+ FOREIGN KEY ("id_feed") REFERENCES "%1$sfeed" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ UNIQUE ("id_feed","guid")
);',
'CREATE INDEX is_favorite_index ON "%1$sentry" ("is_favorite");',
'CREATE INDEX is_read_index ON "%1$sentry" ("is_read");',
'CREATE INDEX entry_lastSeen_index ON "%1$sentry" ("lastSeen");',
-
-'CREATE OR REPLACE RULE check_constraints_on_entry AS ON INSERT TO "%1$sentry" WHERE EXISTS(SELECT 1 FROM "%1$sentry" WHERE guid=NEW.guid) DO INSTEAD NOTHING;',
-'CREATE OR REPLACE RULE check_constraints_on_feed AS ON INSERT TO "%1$sfeed" WHERE EXISTS(SELECT 1 FROM "%1$sfeed" WHERE url=NEW.url) DO INSTEAD NOTHING;',
-'CREATE OR REPLACE RULE check_constraints_on_category AS ON INSERT TO "%1$scategory" WHERE EXISTS(SELECT 1 FROM "%1$scategory" WHERE name=NEW.name) DO INSTEAD NOTHING;',
-'CREATE OR REPLACE RULE check_constraints_on_category as on update to "%1$scategory" WHERE EXISTS(SELECT 1 FROM "%1$scategory" WHERE name=NEW.name) DO INSTEAD NOTHING;',
-
-
'INSERT INTO "%1$scategory" (id, name) VALUES(1, \'%2$s\');',
'INSERT INTO "%1$sfeed" (url, category, name, website, description, ttl) VALUES(\'http://freshrss.org/feeds/all.atom.xml\', 1, \'FreshRSS.org\', \'http://freshrss.org/\', \'FreshRSS, a free, self-hostable aggregator…\', 86400);',
'INSERT INTO "%1$sfeed" (url, category, name, website, description, ttl) VALUES(\'https://github.com/FreshRSS/FreshRSS/releases.atom\', 1, \'FreshRSS @ GitHub\', \'https://github.com/FreshRSS/FreshRSS/\', \'FreshRSS releases @ GitHub\', 86400);',