Added migration to make the combination of slug+domain unique

This commit is contained in:
Alejandro Celaya
2019-10-02 20:01:15 +02:00
parent 25f64a2fc4
commit a892f72425
2 changed files with 50 additions and 1 deletions

View File

@@ -28,7 +28,6 @@ $builder->createField('longUrl', Type::STRING)
$builder->createField('shortCode', Type::STRING)
->columnName('short_code')
->unique()
->length(255)
->build();
@@ -66,3 +65,5 @@ $builder->createManyToOne('domain', Entity\Domain::class)
->addJoinColumn('domain_id', 'id', true, false, 'RESTRICT')
->cascadePersist()
->build();
$builder->addUniqueConstraint(['short_code', 'domain_id'], 'unique_short_code_plus_domain');