// haha yes i forgot the migration
This commit is contained in:
parent
6c4613953a
commit
9f14269fb6
1 changed files with 26 additions and 0 deletions
26
database/2019_12_14_005624_added_chat_tokens_table.php
Normal file
26
database/2019_12_14_005624_added_chat_tokens_table.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
namespace Misuzu\DatabaseMigrations\AddedChatTokensTable;
|
||||
|
||||
use PDO;
|
||||
|
||||
function migrate_up(PDO $conn): void {
|
||||
$conn->exec("
|
||||
CREATE TABLE `msz_user_chat_tokens` (
|
||||
`user_id` INT(10) UNSIGNED NOT NULL,
|
||||
`token_string` CHAR(64) NOT NULL,
|
||||
`token_created` TIMESTAMP NOT NULL DEFAULT current_timestamp(),
|
||||
UNIQUE INDEX `user_chat_token_string_unique` (`token_string`),
|
||||
INDEX `user_chat_token_user_foreign` (`user_id`),
|
||||
INDEX `user_chat_token_created_key` (`token_created`),
|
||||
CONSTRAINT `user_chat_token_user_foreign`
|
||||
FOREIGN KEY (`user_id`)
|
||||
REFERENCES `msz_users` (`user_id`)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
|
||||
");
|
||||
}
|
||||
|
||||
function migrate_down(PDO $conn): void {
|
||||
$conn->exec("DROP TABLE `msz_user_chat_tokens`");
|
||||
}
|
Loading…
Add table
Reference in a new issue