From: paca70 Date: Fri, 30 Jul 2004 10:42:59 +0000 (+0000) Subject: Fixed uncorrect primary key for postgresql. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=08f35869758cf89f975abccb42280306def3068a;p=moodle.git Fixed uncorrect primary key for postgresql. --- diff --git a/mod/wiki/db/postgres7.php b/mod/wiki/db/postgres7.php index cea8de2297..b6e7a1b7e5 100644 --- a/mod/wiki/db/postgres7.php +++ b/mod/wiki/db/postgres7.php @@ -6,6 +6,12 @@ function wiki_upgrade($oldversion) { global $CFG; + if ($oldversion < 2004073000) { + + modify_database("", "ALTER TABLE prefix_wiki_pages DROP COLUMN id;"); + modify_database("", "ALTER TABLE ONLY prefix_wiki_pages + ADD CONSTRAINT id PRIMARY KEY (pagename, \"version\");"); + } return true; } diff --git a/mod/wiki/db/postgres7.sql b/mod/wiki/db/postgres7.sql index 4a80df806f..7ed97cdc64 100644 --- a/mod/wiki/db/postgres7.sql +++ b/mod/wiki/db/postgres7.sql @@ -41,7 +41,6 @@ CREATE TABLE prefix_wiki_entries ( CREATE TABLE prefix_wiki_pages ( - id SERIAL PRIMARY KEY, pagename VARCHAR(160) NOT NULL, version INTEGER NOT NULL DEFAULT 0, flags INTEGER DEFAULT 0, @@ -55,4 +54,7 @@ CREATE TABLE prefix_wiki_pages ( wiki INT8 NOT NULL ) ; +ALTER TABLE ONLY prefix_wiki_pages + ADD CONSTRAINT id PRIMARY KEY (pagename, "version"); + CREATE INDEX prefix_wiki_pages_pagename_version_wiki_idx ON prefix_wiki_pages (pagename, version, wiki) ; diff --git a/mod/wiki/version.php b/mod/wiki/version.php index b46f4f9007..930081f288 100644 --- a/mod/wiki/version.php +++ b/mod/wiki/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2004062400; // The current module version (Date: YYYYMMDDXX) +$module->version = 2004073000; // The current module version (Date: YYYYMMDDXX) $module->cron = 0; // Period for cron to check this module (secs) ?>