From 4f829471ef235ae48f2fd3a404625a12f1c58b5a Mon Sep 17 00:00:00 2001 From: Janis Rullis Date: Sun, 18 Oct 2020 18:53:11 +0300 Subject: [PATCH] #14 Migrations: Add Create the game table --- symfony5/migrations/.gitignore | 0 .../src/Migrations/Version2020101818369.php | 45 +++++++++++++++++++ 2 files changed, 45 insertions(+) delete mode 100644 symfony5/migrations/.gitignore create mode 100644 symfony5/src/Migrations/Version2020101818369.php diff --git a/symfony5/migrations/.gitignore b/symfony5/migrations/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/symfony5/src/Migrations/Version2020101818369.php b/symfony5/src/Migrations/Version2020101818369.php new file mode 100644 index 0000000..1e4b60b --- /dev/null +++ b/symfony5/src/Migrations/Version2020101818369.php @@ -0,0 +1,45 @@ +abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.'); + $this->addSql("CREATE TABLE IF NOT EXISTS `game`( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `status` ENUM( + 'draft', + 'completed', + 'ongoing', + 'other' + ) NULL DEFAULT 'draft' COMMENT '#14.', + `width` TINYINT UNSIGNED NOT NULL DEFAULT 3 COMMENT '2-20. Smaller doesnt make sense, bigger is too rought to process and play. #14 #12', + `height` TINYINT UNSIGNED NOT NULL DEFAULT 3 COMMENT '2-20. Smaller doesnt make sense, bigger is too rought to process and play. #14 #12', + `move_cnt_to_win` TINYINT UNSIGNED NOT NULL DEFAULT 3 COMMENT 'Must be no smaller than the min board dimensions or go outside the board. #14 #15', + `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` TIMESTAMP NULL DEFAULT NULL, + `sys_info` VARCHAR(20) DEFAULT NULL COMMENT 'In case if You need to mark/flag or just leave a comment.', + PRIMARY KEY(`id`), + INDEX `status`(`status`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'Related information in #14.'"); + } + + public function down(Schema $schema): void + { + $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.'); + $this->addSql('DROP TABLE `game`;'); + } +}