go-gorm / gorm

The fantastic ORM library for Golang, aims to be developer friendly
https://gorm.io
MIT License
36.66k stars 3.92k forks source link

feat: add SyncSchema as alias for AutoMigrate() #7070

Closed ei-sugimoto closed 3 months ago

ei-sugimoto commented 3 months ago

What did this pull request do?

This PR is based on issue https://github.com/go-gorm/gorm/issues/7048. GORM users will be able to perform automatic migration of database schemas using either AutoMigrate or SyncSchema.

User Case Description

gorm.AutoMigrate(&model.User{})
gorm.AutoMigrate(&model.Character{})
gorm.AutoMigrate(&model.UserCharacter{})

//or
gorm.SyncSchema(&model.User{})
gorm.SyncSchema(&model.Character{})
gorm.SyncSchema(&model.UserCharacter{})
jinzhu commented 3 months ago

Let's work together to improve the documentation. More APIs are not necessarily better for the project's development and can be ambiguous.