add comment

This commit is contained in:
black 2023-02-23 18:48:03 +08:00
parent 2f228b606c
commit 6537d7ca8d
2 changed files with 2 additions and 4 deletions

View File

@ -30,8 +30,8 @@ func (db *DB) AutoMigrate(dst ...interface{}) error {
// ViewOption view option // ViewOption view option
type ViewOption struct { type ViewOption struct {
Replace bool Replace bool // CREATE [ OR REPLACE ]
CheckOption string CheckOption string // WITH [ CASCADED | LOCAL ] CHECK OPTION
Query *DB Query *DB
} }

View File

@ -571,9 +571,7 @@ func (m Migrator) CreateView(name string, option gorm.ViewOption) error {
m.DB.Statement.AddVar(sql, option.Query) m.DB.Statement.AddVar(sql, option.Query)
if option.CheckOption != "" { if option.CheckOption != "" {
sql.WriteString(" WITH ")
sql.WriteString(option.CheckOption) sql.WriteString(option.CheckOption)
sql.WriteString(" CHECK OPTION")
} }
return m.DB.Exec(sql.String()).Error return m.DB.Exec(sql.String()).Error
} }