Skip to content

Conversation

@erezrokah
Copy link
Member

Summary

Preparation for #17129. This ensures the MySQL destination can handle the change in #17129

@erezrokah erezrokah requested review from a team and maaarcelino and removed request for a team July 15, 2024 11:02
return false
}
case schema.TableColumnChangeTypeRemoveUniqueConstraint:
return true
Copy link
Member Author

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))
Copy link
Member Author

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

Copy link
Contributor

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?

Copy link
Member Author

@erezrokah erezrokah Jul 15, 2024

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

@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Jul 15, 2024
@kodiakhq kodiakhq bot merged commit 6043d4c into cloudquery:main Jul 16, 2024
kodiakhq bot pushed a commit that referenced this pull request Jul 16, 2024
🤖 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).
@erezrokah erezrokah deleted the fix/handle_unique_removal branch July 16, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugin/destination/mysql automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants