dolthub / dolthub/dolt

Schema merge conflict when there should be a clean schema merge

Open
#8,134 0 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
enhancement merge version control
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

```sql
schema_conflicts/main> call dolt_merge('add-units');
+------+--------------+-----------+-----------------+
| hash | fast_forward | conflicts | message |
+------+--------------+-----------+-----------------+
| | 0 | 1 | conflicts found |
+------+--------------+-----------+-----------------+
1 row in set (0.00 sec)

schema_conflicts/main*> select * from dolt_status;
+------------+--------+-----------------+
| table_name | staged | status |
+------------+--------+-----------------+
| weights | 0 | schema conflict |
+------------+--------+-----------------+
1 row in set (0.00 sec)

schema_conflicts/main*> select * from dolt_schema_conflicts;
+------------+-------------------------------------------------------------------+-------------------------------------------------------------------+-------------------------------------------------------------------+------------------------------------------------------------------+
| table_name | base_schema | our_schema | their_schema | description |
+------------+-------------------------------------------------------------------+-------------------------------------------------------------------+-------------------------------------------------------------------+------------------------------------------------------------------+
| weights | CREATE TABLE `weights` ( | CREATE TABLE `weights` ( | CREATE TABLE `weights` ( | incompatible column types for column 'weight': Float32 and Int32 |
| | `id` int NOT NULL, | `id` int NOT NULL, | `id` int NOT NULL, | |
| | `weight` int, | `weight` float, | `weight` int, | |
| | PRIMARY KEY (`id`) | PRIMARY KEY (`id`) | `units` varchar(10), | |
| | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin; | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin; | PRIMARY KEY (`id`) | |
| | | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin; | |
+------------+-------------------------------------------------------------------+-------------------------------------------------------------------+-------------------------------------------------------------------+------------------------------------------------------------------+
1 row in set (0.00 sec)
```

The merge base and `add-units` branch both have `int` as their type for `weight` column. `main` should be free to change the type of `weight` because that column is not modified on `add-units`. Resulting schema should be:

```sql
CREATE TABLE `weights` (
`id` int NOT NULL,
`weight` float,
`units` varchar(10),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.