don't skip temp indexes migration if the indexes column is already created

This commit is contained in:
Gani Georgiev 2023-04-15 00:44:19 +03:00
parent 0351f3a1ad
commit 5ddf9cd443
1 changed files with 8 additions and 3 deletions

View File

@ -42,14 +42,19 @@ func init() {
return err
}
var hasIndexesColumn bool
for _, col := range cols {
if col == "indexes" {
return nil // already existing (probably via the init migration)
// already existing (probably via the init migration)
hasIndexesColumn = true
break
}
}
if _, err := db.AddColumn("_collections", "indexes", `JSON DEFAULT "[]" NOT NULL`).Execute(); err != nil {
return err
if !hasIndexesColumn {
if _, err := db.AddColumn("_collections", "indexes", `JSON DEFAULT "[]" NOT NULL`).Execute(); err != nil {
return err
}
}
collections := []*models.Collection{}