mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Updated migrations to prevent duplication when running after orm schema tool
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user