did I mention that mysql devs can go choke on a bucket of cocks? Well they can. (Two ways to specify foreign keys, one works, one is silently ignored; wtf?)

This commit is contained in:
Shish
2009-01-22 05:03:51 -08:00
parent 46c3989ce5
commit bda38bff6c
12 changed files with 67 additions and 45 deletions

View File

@ -93,11 +93,13 @@ class NumericScore implements Extension {
$database->Execute("ALTER TABLE images ADD COLUMN numeric_score INTEGER NOT NULL DEFAULT 0");
$database->Execute("CREATE INDEX images__numeric_score ON images(numeric_score)");
$database->create_table("numeric_score_votes", "
image_id INTEGER NOT NULL REFERENCES images(id) ON DELETE CASCADE,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
image_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
score INTEGER NOT NULL,
UNIQUE(image_id, user_id),
INDEX(image_id)
INDEX(image_id),
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
");
$config->set_int("ext_numeric_score_version", 1);
}