1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-03-26 16:01:59 +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,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{}