Add ip_changes to postgres/tables.sql
[lhc/web/wiklou.git] / maintenance / postgres / tables.sql
index c7ace89..da9c864 100644 (file)
@@ -158,6 +158,17 @@ CREATE TABLE revision_comment_temp (
 );
 CREATE UNIQUE INDEX revcomment_rev ON revision_comment_temp (revcomment_rev);
 
+CREATE SEQUENCE ip_changes_ipc_rev_id_seq;
+
+CREATE TABLE ip_changes (
+  ipc_rev_id        INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('ip_changes_ipc_rev_id_seq'),
+  ipc_rev_timestamp TIMESTAMPTZ NOT NULL,
+  ipc_hex           BYTEA NOT NULL DEFAULT ''
+);
+
+CREATE INDEX ipc_rev_timestamp ON ip_changes (ipc_rev_timestamp);
+CREATE INDEX ipc_hex_time ON ip_changes (ipc_hex,ipc_rev_timestamp);
+
 CREATE SEQUENCE text_old_id_seq;
 CREATE TABLE pagecontent ( -- replaces reserved word 'text'
   old_id     INTEGER  NOT NULL  PRIMARY KEY DEFAULT nextval('text_old_id_seq'),
@@ -296,7 +307,7 @@ CREATE INDEX langlinks_lang_title    ON langlinks (ll_lang,ll_title);
 
 
 CREATE TABLE site_stats (
-  ss_row_id         INTEGER  NOT NULL  UNIQUE,
+  ss_row_id         INTEGER  NOT NULL  PRIMARY KEY DEFAULT 0,
   ss_total_edits    INTEGER            DEFAULT 0,
   ss_good_articles  INTEGER            DEFAULT 0,
   ss_total_pages    INTEGER            DEFAULT -1,
@@ -358,8 +369,8 @@ CREATE INDEX img_sha1          ON image (img_sha1);
 
 CREATE TABLE image_comment_temp (
        imgcomment_name       TEXT NOT NULL,
-       imgcomment_comment_id INTEGER NOT NULL,
-       PRIMARY KEY (imgcomment_name, imgcomment_comment_id)
+       imgcomment_description_id INTEGER NOT NULL,
+       PRIMARY KEY (imgcomment_name, imgcomment_description_id)
 );
 CREATE UNIQUE INDEX imgcomment_name ON image_comment_temp (imgcomment_name);