From b3e997332c60a642f9ae2967cf8f376c11b35d52 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 7 May 2018 11:01:16 +0200 Subject: [PATCH] Migrations --- src/Migrations/Version20180507081943.php | 28 ++++++++++++++++++++++++ src/Migrations/Version20180507084936.php | 28 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/Migrations/Version20180507081943.php create mode 100644 src/Migrations/Version20180507084936.php diff --git a/src/Migrations/Version20180507081943.php b/src/Migrations/Version20180507081943.php new file mode 100644 index 0000000..ccd98a6 --- /dev/null +++ b/src/Migrations/Version20180507081943.php @@ -0,0 +1,28 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('CREATE TABLE question (id INT AUTO_INCREMENT NOT NULL, text VARCHAR(255) NOT NULL, response INT NOT NULL, responses JSON DEFAULT NULL COMMENT \'(DC2Type:json_array)\', valided TINYINT(1) NOT NULL, gameover TINYINT(1) NOT NULL, date DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('DROP TABLE question'); + } +} diff --git a/src/Migrations/Version20180507084936.php b/src/Migrations/Version20180507084936.php new file mode 100644 index 0000000..f80f4aa --- /dev/null +++ b/src/Migrations/Version20180507084936.php @@ -0,0 +1,28 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('CREATE TABLE response (id INT AUTO_INCREMENT NOT NULL, text VARCHAR(255) NOT NULL, question INT NOT NULL, child JSON NOT NULL COMMENT \'(DC2Type:json_array)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('DROP TABLE response'); + } +}