Skip to content
Snippets Groups Projects
Verified Commit cd709e14 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

refactor: simplify return from Migrator operations & AutoMigrate calls

parent bfb0fec3
No related branches found
No related tags found
No related merge requests found
......@@ -109,17 +109,10 @@ var (
Encoded []byte
}
if err := tx.AutoMigrate(&ImportLog{}); err != nil {
return err
}
return nil
return tx.AutoMigrate(&ImportLog{})
},
Rollback: func(tx *gorm.DB) error {
if err := tx.Migrator().DropConstraint(&ImportLog{}, "file_id"); err != nil {
return err
}
return nil
return tx.Migrator().DropConstraint(&ImportLog{}, "file_id")
},
},
{
......@@ -323,19 +316,13 @@ var (
)
func initialMigration(tx *gorm.DB) (err error) {
err = tx.AutoMigrate(
return tx.AutoMigrate(
&Show{},
&File{},
&ImportLog{},
&Playlist{},
&PlaylistEntry{},
)
if err != nil {
return
}
return nil
}
func (st *Store) initDBModel(cfg DBConfig) (err error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment