Removed the existing, broken follow system.
This commit is contained in:
parent
813d3421bb
commit
50dee8eeb4
17 changed files with 64 additions and 663 deletions
33
database/2021_08_28_220000_nuke_relations_table.php
Normal file
33
database/2021_08_28_220000_nuke_relations_table.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace Misuzu\DatabaseMigrations\NukeRelationsTable;
|
||||
|
||||
use PDO;
|
||||
|
||||
function migrate_up(PDO $conn): void {
|
||||
$conn->exec("DROP TABLE `msz_user_relations`");
|
||||
}
|
||||
|
||||
function migrate_down(PDO $conn): void {
|
||||
$conn->exec("
|
||||
CREATE TABLE `msz_user_relations` (
|
||||
`user_id` INT(10) UNSIGNED NOT NULL,
|
||||
`subject_id` INT(10) UNSIGNED NOT NULL,
|
||||
`relation_type` TINYINT(3) UNSIGNED NOT NULL,
|
||||
`relation_created` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
|
||||
UNIQUE INDEX `user_relations_unique` (`user_id`, `subject_id`) USING BTREE,
|
||||
INDEX `user_relations_subject_id_foreign` (`subject_id`) USING BTREE,
|
||||
INDEX `user_relations_type_index` (`relation_type`) USING BTREE,
|
||||
INDEX `user_relations_created_index` (`relation_created`) USING BTREE,
|
||||
CONSTRAINT `user_relations_subject_id_foreign`
|
||||
FOREIGN KEY (`subject_id`)
|
||||
REFERENCES `msz_users` (`user_id`)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `user_relations_user_id_foreign`
|
||||
FOREIGN KEY (`user_id`)
|
||||
REFERENCES `msz_users` (`user_id`)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
|
||||
");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue