1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-03-29 17:10:44 +02:00

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

View File

@ -42,15 +42,20 @@ 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 !hasIndexesColumn {
if _, err := db.AddColumn("_collections", "indexes", `JSON DEFAULT "[]" NOT NULL`).Execute(); err != nil {
return err
}
}
collections := []*models.Collection{}
if err := dao.CollectionQuery().AndWhere(dbx.NewExp("type != 'view'")).All(&collections); err != nil {