misuzu/database/2023_04_30_001226_create_topic_redirs_table.php

23 lines
980 B
PHP

<?php
use Index\Data\IDbConnection;
use Index\Data\Migration\IDbMigration;
final class CreateTopicRedirsTable_20230430_001226 implements IDbMigration {
public function migrate(IDbConnection $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;
');
}
}