don't skip temp indexes migration if the indexes column is already created
This commit is contained in:
parent
0351f3a1ad
commit
5ddf9cd443
|
@ -42,15 +42,20 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasIndexesColumn bool
|
||||||
for _, col := range cols {
|
for _, col := range cols {
|
||||||
if col == "indexes" {
|
if col == "indexes" {
|
||||||
return nil // already existing (probably via the init migration)
|
// already existing (probably via the init migration)
|
||||||
|
hasIndexesColumn = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !hasIndexesColumn {
|
||||||
if _, err := db.AddColumn("_collections", "indexes", `JSON DEFAULT "[]" NOT NULL`).Execute(); err != nil {
|
if _, err := db.AddColumn("_collections", "indexes", `JSON DEFAULT "[]" NOT NULL`).Execute(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
collections := []*models.Collection{}
|
collections := []*models.Collection{}
|
||||||
if err := dao.CollectionQuery().AndWhere(dbx.NewExp("type != 'view'")).All(&collections); err != nil {
|
if err := dao.CollectionQuery().AndWhere(dbx.NewExp("type != 'view'")).All(&collections); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue