Constraint names we generate by convention don't check for duplicates with explicitly generated constraint names
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
E.g. migration test like:
```cs
await Test(
builder =>
{
builder.Entity("Entity").Property("Id");
builder.Entity("Entity").HasKey("Id").HasName("PK_AnotherEntity");
},
builder => { },
builder =>
{
builder.Entity("AnotherEntity").Property("Id");
},
model =>
{
});
```
We explicitly generate PK_AnotherEntity, then create new entity who's by convention PK constraint is named the same -
```
Microsoft.Data.SqlClient.SqlException : There is already an object named 'PK_AnotherEntity' in the database.
Could not create constraint or index. See previous errors.
```
Ideally we would check all constraint types - one could generate default constraint with a name that would clash with PK constraint, or vice versa - this still results in the same error
Contributor guide
Assessment
This issue has not been assessed yet.