Permalink
Browse files

Fixed uncorrect primary key for postgresql.

  • Loading branch information...
1 parent 3689f18 commit 08f35869758cf89f975abccb42280306def3068a paca70 committed Jul 30, 2004
Showing with 10 additions and 2 deletions.
  1. +6 −0 mod/wiki/db/postgres7.php
  2. +3 −1 mod/wiki/db/postgres7.sql
  3. +1 −1 mod/wiki/version.php
View
6 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;
}
View
4 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) ;
View
2 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)
?>

0 comments on commit 08f3586

Please sign in to comment.