Skip to content

feat: deal with the unique field migrator#105

Merged
jinzhu merged 2 commits intogo-gorm:masterfrom
Icemap:feat-tidb-unique-deal
Feb 8, 2023
Merged

feat: deal with the unique field migrator#105
jinzhu merged 2 commits intogo-gorm:masterfrom
Icemap:feat-tidb-unique-deal

Conversation

@Icemap
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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