CHECK constraints being renamed to MySQL defaults
- Dominant language
- Go
- Stars
- 13.6k
- Forks
- 1.4k
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 4
Description
gh-ost version: 1.1.6
We noticed when migrating tables with named `CHECK` constraints, they were renamed after the migration to the MySQL default names.
eg:
A `CHECK` constraint on a table `foo` named `my_check_constraint` is renamed to `foo_check_1` after a gh-ost migration of table `foo`.
I suspect this is because it looks like gh-ost is using a `CREATE TABLE ... LIKE` stmt referenced [here](https://github.com/github/gh-ost/blob/master/go/logic/applier.go#L223). `CREATE TABLE ... LIKE` will copy the CHECK constraints but generate their names. [[src]](https://dev.mysql.com/doc/refman/8.0/en/create-table-like.html)
> For CREATE TABLE ... LIKE, the destination table preserves CHECK constraints from the original table, except that all the constraint names are generated.
We'd like to keep these `CHECK` constraint names consistent if possible. Is this a feature that can be added in a future release or a welcomed PR?
Thanks for all of the great work on gh-ost!
Contributor guide
Assessment
This issue has not been assessed yet.