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: migrator support table comment #6225

Merged
merged 9 commits into from
May 5, 2023

Conversation

maiqingqiang
Copy link
Contributor

@maiqingqiang maiqingqiang commented Apr 10, 2023

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

What did this pull request do?

migrator support table comment.

  1. feat: migrator support table comment #6225
  2. feat: migrator support table comment mysql#114
  3. feat: support table comment gen#822

User Case Description

@jinzhu
Copy link
Member

jinzhu commented Apr 11, 2023

Maybe better to have an API like ColumnTypes to return table-related information...

@maiqingqiang
Copy link
Contributor Author

Maybe better to have an API like ColumnTypes to return table-related information...

Okay, I'll make some changes.

@jinzhu
Copy link
Member

jinzhu commented Apr 11, 2023

Maybe better to have an API like ColumnTypes to return table-related information...

Okay, I'll make some changes.

Thank you, we can add a Tables method to the Migrator interface, it returns a TableType interface which contains Name, Comment... methods

@maiqingqiang
Copy link
Contributor Author

Maybe better to have an API like ColumnTypes to return table-related information...

Okay, I'll make some changes.

Thank you, we can add a Tables method to the Migrator interface, it returns a TableType interface which contains Name, Comment... methods

Yeah, I think so too.

image

@maiqingqiang
Copy link
Contributor Author

I've finished developing the TableType method. @jinzhu

        tableType := g.db.Migrator().TableType(tableName)
	log.Printf("table catalog: %s", tableType.Catalog())
	log.Printf("table schema: %s", tableType.Schema())
	log.Printf("table name: %s", tableType.Name())
	log.Printf("table type: %s", tableType.Type())

	engine, ok := tableType.Engine()
	log.Printf("table engine: %s ok:%v", engine, ok)

	comment, ok = tableType.Comment()
	log.Printf("table comment: %s ok:%v", comment, ok)

	log.Printf("tableType: %+v", tableType)

image

migrator.go Show resolved Hide resolved
@maiqingqiang maiqingqiang requested a review from jinzhu May 4, 2023 15:15
@jinzhu jinzhu merged commit e61b98d into go-gorm:master May 5, 2023
23 checks passed
@yiranzai
Copy link

yiranzai commented May 6, 2023

LGTM

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.

None yet

3 participants