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); } } } }