You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Data/Schema/Sql/PrimaryKeyRemove.cs

23 lines
536 B

2 years ago
namespace Connected.Data.Schema.Sql
{
internal class PrimaryKeyRemove : ColumnTransaction
{
public PrimaryKeyRemove(ExistingSchema existing, ISchemaColumn column) : base(column)
{
Existing = existing;
}
private ExistingSchema Existing { get; }
protected override async Task OnExecute()
{
if (Existing.Indexes.FirstOrDefault(f => f.Type == IndexType.PrimaryKey) is ObjectIndex constraint)
{
await new ConstraintDrop(constraint).Execute(Context);
Existing.Indexes.Remove(constraint);
}
}
}
}