Improved how existing imported short URLs are checked by tracking its original short code

This commit is contained in:
Alejandro Celaya
2020-10-25 11:57:26 +01:00
parent 786e4f642b
commit 7c343f42c1
7 changed files with 49 additions and 21 deletions

View File

@@ -21,6 +21,15 @@ final class Version20201023090929 extends AbstractMigration
'length' => 255,
'notnull' => false,
]);
$shortUrls->addColumn('import_original_short_code', Types::STRING, [
'length' => 255,
'notnull' => false,
]);
$shortUrls->addUniqueIndex(
[self::IMPORT_SOURCE_COLUMN, 'import_original_short_code', 'domain_id'],
'unique_imports',
);
}
public function down(Schema $schema): void
@@ -29,5 +38,7 @@ final class Version20201023090929 extends AbstractMigration
$this->skipIf(! $shortUrls->hasColumn(self::IMPORT_SOURCE_COLUMN));
$shortUrls->dropColumn(self::IMPORT_SOURCE_COLUMN);
$shortUrls->dropColumn('import_original_short_code');
$shortUrls->dropIndex('unique_imports');
}
}