wip: workgroup description
This commit is contained in:
@ -27,7 +27,8 @@ func applyMigration(ctx context.Context, ctn *service.Container) error {
|
||||
|
||||
// Register available migrations
|
||||
migr.Register(
|
||||
m000initialSchema(),
|
||||
m000InitialSchema(),
|
||||
m001WorkgroupDescription(),
|
||||
)
|
||||
|
||||
currentVersion, err := migr.CurrentVersion(ctx)
|
||||
@ -84,7 +85,7 @@ var initialModels = []interface{}{
|
||||
&model.Event{},
|
||||
}
|
||||
|
||||
func m000initialSchema() orm.Migration {
|
||||
func m000InitialSchema() orm.Migration {
|
||||
return orm.NewDBMigration(
|
||||
"00_initial_schema",
|
||||
func(ctx context.Context, tx *gorm.DB) error {
|
||||
@ -107,3 +108,23 @@ func m000initialSchema() orm.Migration {
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func m001WorkgroupDescription() orm.Migration {
|
||||
return orm.NewDBMigration(
|
||||
"01_workgroup_description",
|
||||
func(ctx context.Context, tx *gorm.DB) error {
|
||||
if err := tx.AutoMigrate(&model.Workgroup{}).Error; err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
func(ctx context.Context, tx *gorm.DB) error {
|
||||
if err := tx.Model(&model.Workgroup{}).DropColumn("description").Error; err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user