Skip to content
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: deal with the unique field migrator #105

Merged
merged 2 commits into from
Feb 8, 2023

Conversation

Icemap
Copy link
Contributor

@Icemap Icemap commented Feb 1, 2023

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

To handle the AlterColumn(), because TiDB can't change column constraint.

User Case Description

@jinzhu
Copy link
Member

jinzhu commented Feb 1, 2023

Maybe we can add a DontSupportRenameColumnUnique field to Config, and during initialize, set it to true if dialector.ServerVersion contains TiDB?

And in the AlterColumn method just remove the Unique from the FullDataType if DontSupportRenameColumnUnique is true?

@Icemap
Copy link
Contributor Author

Icemap commented Feb 2, 2023

Sure. But it would be taken time. Because I have a little bit thing need to develop from the company. I'll come back here maybe next week.

@Icemap
Copy link
Contributor Author

Icemap commented Feb 8, 2023

Maybe we can add a DontSupportRenameColumnUnique field to Config, and during initialize, set it to true if dialector.ServerVersion contains TiDB?

And in the AlterColumn method just remove the Unique from the FullDataType if DontSupportRenameColumnUnique is true?

Hi @jinzhu, I already make it done. PTAL again.

@jinzhu jinzhu merged commit 70d48fe into go-gorm:master Feb 8, 2023
@Icemap
Copy link
Contributor Author

Icemap commented Feb 8, 2023

Continue for go-gorm/gorm#6014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants