Basic collection setup

This commit is contained in:
Simon Martens
2025-02-07 20:36:52 +01:00
parent c33eabae42
commit 706349e748
10 changed files with 125 additions and 76 deletions

View File

@@ -1,18 +1,27 @@
package migrations
import (
"github.com/Theodor-Springmann-Stiftung/musenalm/models"
"github.com/pocketbase/pocketbase/core"
m "github.com/pocketbase/pocketbase/migrations"
)
func init() {
m.Register(func(app core.App) error {
// add up queries...
collection, err := basicRelationCollection(app, models.ENTRIES_TABLE, models.SERIES_TABLE, models.SERIES_RELATIONS)
if err != nil {
return err
}
return nil
collection.Fields.Add(&core.TextField{Name: "numbering", Required: false, Presentable: true})
return app.Save(collection)
}, func(app core.App) error {
// add down queries...
collection, err := app.FindCollectionByNameOrId(relationTableName(models.ENTRIES_TABLE, models.SERIES_TABLE))
if err != nil {
return nil
}
return nil
return app.Delete(collection)
})
}