misuzu/database/2023_04_30_001226_create_topic_redirs_table.php

24 lines
972 B
PHP
Raw Normal View History

<?php
2024-10-05 02:40:29 +00:00
use Index\Db\DbConnection;
use Index\Db\Migration\DbMigration;
2024-10-05 02:40:29 +00:00
final class CreateTopicRedirsTable_20230430_001226 implements DbMigration {
public function migrate(DbConnection $conn): void {
$conn->execute('
CREATE TABLE msz_forum_topics_redirects (
topic_id INT(10) UNSIGNED NOT NULL,
user_id INT(10) UNSIGNED NULL DEFAULT NULL,
topic_redir_url VARCHAR(255) NOT NULL,
topic_redir_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (topic_id),
KEY topics_redirs_user_foreign (user_id),
CONSTRAINT topics_redirs_user_foreign
FOREIGN KEY (user_id)
REFERENCES msz_users (user_id)
ON DELETE SET NULL
ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin;
');
}
}