A database update, for user deletion
now user_favorites clean itself too. And a DBfix for those who installed shimmie before this date.
This commit is contained in:
parent
8eaaa6a7ca
commit
b219d79a22
2 changed files with 13 additions and 1 deletions
10
DBupdate.php
Normal file
10
DBupdate.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
require_once "core/compat.inc.php";
|
||||||
|
require_once "core/database.class.php";
|
||||||
|
include_once "config.php";
|
||||||
|
$db = new Database();
|
||||||
|
echo "Fixing user_favorites table....";
|
||||||
|
($db->Execute("ALTER TABLE user_favorites ENGINE=InnoDB;")) ? print_r("ok<br>") : print_r("failed<br>");
|
||||||
|
echo "adding Foreign key to users...";
|
||||||
|
($db->Execute("ALTER TABLE user_favorites ADD FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;"))? print_r("ok<br>"):print_r("failed<br>");
|
||||||
|
?>
|
|
@ -144,8 +144,10 @@ class Favorites extends SimpleExtension {
|
||||||
image_id INTEGER NOT NULL,
|
image_id INTEGER NOT NULL,
|
||||||
user_id INTEGER NOT NULL,
|
user_id INTEGER NOT NULL,
|
||||||
created_at DATETIME NOT NULL,
|
created_at DATETIME NOT NULL,
|
||||||
|
INDEX(image_id),
|
||||||
UNIQUE(image_id, user_id),
|
UNIQUE(image_id, user_id),
|
||||||
INDEX(image_id)
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE
|
||||||
)
|
)
|
||||||
");
|
");
|
||||||
$config->set_int("ext_favorites_version", 1);
|
$config->set_int("ext_favorites_version", 1);
|
||||||
|
|
Reference in a new issue