Added user name history beginnings.

This commit is contained in:
flash 2025-02-09 01:32:25 +00:00
parent 7f7e644069
commit cc37b7cad3
6 changed files with 207 additions and 1 deletions

View file

@ -0,0 +1,28 @@
<?php
use Index\Db\DbConnection;
use Index\Db\Migration\DbMigration;
final class CreatedUserNameHistoryTable_20250209_005714 implements DbMigration {
public function migrate(DbConnection $conn): void {
$conn->execute(<<<SQL
CREATE TABLE msz_users_names_history (
history_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NULL DEFAULT NULL,
history_name_before VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci',
history_name_after VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci',
history_private TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
history_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (history_id),
INDEX users_names_history_users_foreign (user_id),
INDEX users_names_history_name_before_index (history_name_before),
INDEX users_names_history_created_index (history_created),
INDEX users_names_history_private_index (history_private),
CONSTRAINT users_names_history_users_foreign
FOREIGN KEY (user_id)
REFERENCES msz_users (user_id)
ON UPDATE CASCADE
ON DELETE SET NULL
) COLLATE='utf8mb4_bin';
SQL);
}
}