-
Notifications
You must be signed in to change notification settings - Fork 547
feat: Auto migrate removal of unique constraints #18569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Auto migrate removal of unique constraints #18569
Conversation
| return false | ||
| } | ||
| case schema.TableColumnChangeTypeRemoveUniqueConstraint: | ||
| return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| return false |
🤖 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