Backend: Fix AfterCreate after upgrading GORM
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
132db3c0d2
commit
1cf0893b18
|
@ -69,7 +69,8 @@ func (m *Country) FirstOrCreate() *Country {
|
|||
|
||||
// AfterCreate sets the New column used for database callback
|
||||
func (m *Country) AfterCreate(scope *gorm.Scope) error {
|
||||
return scope.SetColumn("New", true)
|
||||
m.New = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// Code returns country code
|
||||
|
|
|
@ -72,7 +72,8 @@ func (m *Label) FirstOrCreate() *Label {
|
|||
|
||||
// AfterCreate sets the New column used for database callback
|
||||
func (m *Label) AfterCreate(scope *gorm.Scope) error {
|
||||
return scope.SetColumn("New", true)
|
||||
m.New = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetName changes the label name.
|
||||
|
|
|
@ -70,6 +70,7 @@ func TestLabel_Update(t *testing.T) {
|
|||
assert.Equal(t, "label", Label.LabelName)
|
||||
|
||||
err := Label.Update(*classifyLabel)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ func CreateUnknownPlace() {
|
|||
|
||||
// AfterCreate sets the New column used for database callback
|
||||
func (m *Place) AfterCreate(scope *gorm.Scope) error {
|
||||
return scope.SetColumn("New", true)
|
||||
m.New = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindPlaceByLabel returns a place from an id or a label
|
||||
|
|
Loading…
Reference in New Issue
Block a user