test ignore migration, close #4314, #4315

This commit is contained in:
Jinzhu 2021-05-05 08:26:15 +08:00
parent 3f359eab9b
commit 2aca96d147
1 changed files with 2 additions and 0 deletions

View File

@ -235,6 +235,7 @@ type UserWithPermissionControl struct {
Name5 string `gorm:"<-:update"` Name5 string `gorm:"<-:update"`
Name6 string `gorm:"<-:create,update"` Name6 string `gorm:"<-:create,update"`
Name7 string `gorm:"->:false;<-:create,update"` Name7 string `gorm:"->:false;<-:create,update"`
Name8 string `gorm:"->;-:migration"`
} }
func TestParseFieldWithPermission(t *testing.T) { func TestParseFieldWithPermission(t *testing.T) {
@ -252,6 +253,7 @@ func TestParseFieldWithPermission(t *testing.T) {
{Name: "Name5", DBName: "name5", BindNames: []string{"Name5"}, DataType: schema.String, Tag: `gorm:"<-:update"`, Creatable: false, Updatable: true, Readable: true}, {Name: "Name5", DBName: "name5", BindNames: []string{"Name5"}, DataType: schema.String, Tag: `gorm:"<-:update"`, Creatable: false, Updatable: true, Readable: true},
{Name: "Name6", DBName: "name6", BindNames: []string{"Name6"}, DataType: schema.String, Tag: `gorm:"<-:create,update"`, Creatable: true, Updatable: true, Readable: true}, {Name: "Name6", DBName: "name6", BindNames: []string{"Name6"}, DataType: schema.String, Tag: `gorm:"<-:create,update"`, Creatable: true, Updatable: true, Readable: true},
{Name: "Name7", DBName: "name7", BindNames: []string{"Name7"}, DataType: schema.String, Tag: `gorm:"->:false;<-:create,update"`, Creatable: true, Updatable: true, Readable: false}, {Name: "Name7", DBName: "name7", BindNames: []string{"Name7"}, DataType: schema.String, Tag: `gorm:"->:false;<-:create,update"`, Creatable: true, Updatable: true, Readable: false},
{Name: "Name8", DBName: "name8", BindNames: []string{"Name8"}, DataType: schema.String, Tag: `gorm:"<->"`, Creatable: false, Updatable: false, Readable: true, IgnoreMigration: true},
} }
for _, f := range fields { for _, f := range fields {