From e0ef1a1c8b6badd2f52acbdcf928469ef1a15b3e Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Mon, 4 Sep 2017 23:39:08 +0200 Subject: Add originUrl property to Entry, handle that in EntryRestController, handle migration Signed-off-by: Kevin Decherf --- app/DoctrineMigrations/Version20171105202000.php | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/DoctrineMigrations/Version20171105202000.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20171105202000.php b/app/DoctrineMigrations/Version20171105202000.php new file mode 100644 index 00000000..b1cff9ce --- /dev/null +++ b/app/DoctrineMigrations/Version20171105202000.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('origin_url'), 'It seems that you already played this migration.'); + + $entryTable->addColumn('origin_url', 'text', [ + 'notnull' => false, + ]); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $entryTable = $schema->getTable($this->getTable('entry')); + + $this->skipIf(!$entryTable->hasColumn('origin_url'), 'It seems that you already played this migration.'); + + $entryTable->dropColumn('origin_url'); + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix') . $tableName; + } +} -- cgit v1.2.3 From eae8138b33e4ed4a5d1a98daf77941ef691629de Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sun, 19 Nov 2017 15:26:13 +0100 Subject: Fix phpcs Signed-off-by: Kevin Decherf --- app/DoctrineMigrations/Version20171105202000.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20171105202000.php b/app/DoctrineMigrations/Version20171105202000.php index b1cff9ce..3769045f 100644 --- a/app/DoctrineMigrations/Version20171105202000.php +++ b/app/DoctrineMigrations/Version20171105202000.php @@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Add origin_url column + * Add origin_url column. */ class Version20171105202000 extends AbstractMigration implements ContainerAwareInterface { -- cgit v1.2.3