@@ -352,26 +352,28 @@ func ResolveSchemaConflicts(ctx *sql.Context, ddb *doltdb.DoltDB, ws *doltdb.Wor
352
352
return ws , nil // no schema conflicts
353
353
}
354
354
355
- // TODO: There's an issue with using `dolt conflicts resolve` for schema conflicts, since having
356
- //
357
- // schema conflicts reported means that we haven't yet merged the table data. In some case,
358
- // such as when there have ONLY been schema changes and no data changes that need to be
359
- // merged, it is safe to use `dolt conflicts resolve`, but there are many other cases where the
360
- // data changes would not be merged and could surprise customers. So, we are being cautious to
361
- // prevent auto-resolution of schema changes with `dolt conflicts resolve` until we have a fix
362
- // for resolving schema changes AND merging data (including dealing with any data conflicts).
363
- // For more details, see: https://github.com/dolthub/dolt/issues/6616
364
- if ws .MergeState ().HasSchemaConflicts () {
365
- return nil , fmt .Errorf ("Unable to automatically resolve schema conflicts since data changes may " +
366
- "not have been fully merged yet. " +
367
- "To continue, abort this merge (dolt merge --abort) then apply ALTER TABLE statements to one " +
368
- "side of this merge to get the two schemas in sync with the desired schema, then rerun the merge. " +
369
- "To track resolution of this limitation, follow https://github.com/dolthub/dolt/issues/6616" )
370
- }
371
-
372
355
tblSet := doltdb .NewTableNameSet (tblNames )
373
356
updates := make (map [doltdb.TableName ]* doltdb.Table )
374
357
err := ws .MergeState ().IterSchemaConflicts (ctx , ddb , func (table doltdb.TableName , conflict doltdb.SchemaConflict ) error {
358
+ // If one side dropped the table, we don't need to worry about correctly merging data. Otherwise, be cautious
359
+ // and prevent the merge.
360
+ if conflict .ToSch != nil && conflict .FromSch != nil {
361
+ // TODO: There's an issue with using `dolt conflicts resolve` for schema conflicts, since having
362
+ // schema conflicts reported means that we haven't yet merged the table data. In some cases,
363
+ // such as when one side of the branch drops the table, or when there have ONLY been schema changes
364
+ // and no data changes that need to be merged, it is safe to use `dolt conflicts resolve`, but there are
365
+ // many other cases where the data changes would not be merged and could surprise customers. So, we are
366
+ // being cautious to prevent auto-resolution of schema changes with `dolt conflicts resolve` until we have
367
+ // a fix for resolving schema changes AND merging data (including dealing with any data conflicts).
368
+ // For more details, see: https://github.com/dolthub/dolt/issues/6616
369
+ if ws .MergeState ().HasSchemaConflicts () {
370
+ return fmt .Errorf ("Unable to automatically resolve schema conflicts since data changes may " +
371
+ "not have been fully merged yet. " +
372
+ "To continue, abort this merge (dolt merge --abort) then apply ALTER TABLE statements to one " +
373
+ "side of this merge to get the two schemas in sync with the desired schema, then rerun the merge. " +
374
+ "To track resolution of this limitation, follow https://github.com/dolthub/dolt/issues/6616" )
375
+ }
376
+ }
375
377
if ! tblSet .Contains (table ) {
376
378
return nil
377
379
}
0 commit comments