diff --git a/data/migrations/Version20171021093246.php b/data/migrations/Version20171021093246.php index a9c39ebb..d0aff69b 100644 --- a/data/migrations/Version20171021093246.php +++ b/data/migrations/Version20171021093246.php @@ -20,6 +20,10 @@ class Version20171021093246 extends AbstractMigration public function up(Schema $schema) { $shortUrls = $schema->getTable('short_urls'); + if ($shortUrls->hasColumn('value_since')) { + return; + } + $shortUrls->addColumn('valid_since', Type::DATETIME, [ 'notnull' => false, ]); @@ -35,6 +39,10 @@ class Version20171021093246 extends AbstractMigration public function down(Schema $schema) { $shortUrls = $schema->getTable('short_urls'); + if (! $shortUrls->hasColumn('value_since')) { + return; + } + $shortUrls->dropColumn('valid_since'); $shortUrls->dropColumn('valid_until'); } diff --git a/data/migrations/Version20171022064541.php b/data/migrations/Version20171022064541.php index bac05c61..ef0447aa 100644 --- a/data/migrations/Version20171022064541.php +++ b/data/migrations/Version20171022064541.php @@ -20,6 +20,10 @@ class Version20171022064541 extends AbstractMigration public function up(Schema $schema) { $shortUrls = $schema->getTable('short_urls'); + if ($shortUrls->hasColumn('max_visits')) { + return; + } + $shortUrls->addColumn('max_visits', Type::INTEGER, [ 'unsigned' => true, 'notnull' => false, @@ -33,6 +37,10 @@ class Version20171022064541 extends AbstractMigration public function down(Schema $schema) { $shortUrls = $schema->getTable('short_urls'); + if (! $shortUrls->hasColumn('max_visits')) { + return; + } + $shortUrls->dropColumn('max_visits'); } }