From c1c0f09949c85218b720280d84eca70dad51b65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 10 Jul 2017 21:32:25 +0200 Subject: Added given_url in entry table --- app/DoctrineMigrations/Version20170710125843.php | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/DoctrineMigrations/Version20170710125843.php (limited to 'app/DoctrineMigrations/Version20170710125843.php') diff --git a/app/DoctrineMigrations/Version20170710125843.php b/app/DoctrineMigrations/Version20170710125843.php new file mode 100644 index 00000000..1bac94d8 --- /dev/null +++ b/app/DoctrineMigrations/Version20170710125843.php @@ -0,0 +1,55 @@ +container = $container; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf($entryTable->hasColumn('given_url'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('given_url', 'text', [ + 'notnull' => false, + ]); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('given_url'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('given_url'); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } +} -- cgit v1.2.3