feat: Auto migrate removal of unique constraints#18569
Conversation
| return false | ||
| } | ||
| case schema.TableColumnChangeTypeRemoveUniqueConstraint: | ||
| return true |
There was a problem hiding this comment.
This was a bug, we need continue to ensure we take into account all changes
| builder.WriteString("ALTER TABLE ") | ||
| builder.WriteString(identifier(table.Name)) | ||
| builder.WriteString(" DROP INDEX ") | ||
| builder.WriteString(identifier(column.Name)) |
There was a problem hiding this comment.
This is the default name for the constraint, we could try and read the name as well, but since we're the ones adding it with the default name I think that's ok for now
There was a problem hiding this comment.
The name suggests this function drops unique indexes only, but I think it can drop any index, right?
There was a problem hiding this comment.
Correct. renamed the function to clarify. Other indices changes won't be identified as a unique constraint removal, but as a TableColumnChangeTypeUpdate (https://github.com/cloudquery/plugin-sdk/blob/316e1e30736bdb0dc2f1e38755e0437629373ae5/schema/table.go#L502), and they are not auto migratable per
🤖 I have created a release *beep* *boop* --- ## [5.2.0](plugins-destination-mysql-v5.1.4...plugins-destination-mysql-v5.2.0) (2024-07-16) ### Features * Add connection test to MySQL destination ([#18549](#18549)) ([b79835d](b79835d)) * Auto migrate removal of unique constraints ([#18569](#18569)) ([6043d4c](6043d4c)) ### Bug Fixes * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.49.3 ([#18513](#18513)) ([d12da90](d12da90)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
Preparation for #17129. This ensures the MySQL destination can handle the change in #17129