PostgreSQL does not support INDEX() inside the CREATE TABLE method. You must create the index as a separate query. Fortunately MySQL also support this way of doing things as well.

This commit is contained in:
jgen
2014-02-22 23:02:11 -05:00
parent 5effee4812
commit 9892d1f7fd
12 changed files with 21 additions and 27 deletions

View File

@@ -80,12 +80,12 @@ class CommentList extends Extension {
owner_ip SCORE_INET NOT NULL,
posted DATETIME DEFAULT NULL,
comment TEXT NOT NULL,
INDEX (image_id),
INDEX (owner_ip),
INDEX (posted),
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE,
FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT
");
$database->execute("CREATE INDEX comments_image_id_idx ON comments(image_id)", array());
$database->execute("CREATE INDEX comments_owner_id_idx ON comments(owner_id)", array());
$database->execute("CREATE INDEX comments_posted_idx ON bookmark(posted)", array());
$config->set_int("ext_comments_version", 3);
}
@@ -97,9 +97,9 @@ class CommentList extends Extension {
owner_id INTEGER NOT NULL,
owner_ip CHAR(16) NOT NULL,
posted DATETIME DEFAULT NULL,
comment TEXT NOT NULL,
INDEX (image_id)
comment TEXT NOT NULL
");
$database->execute("CREATE INDEX comments_image_id_idx ON comments(image_id)", array());
$config->set_int("ext_comments_version", 1);
}