mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
deleted bad migfration structure
This commit is contained in:
38
migrations/1739446527_kontakt.go
Normal file
38
migrations/1739446527_kontakt.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/Theodor-Springmann-Stiftung/musenalm/pagemodels"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
var kontakt_fields = core.NewFieldsList(
|
||||
pagemodels.EditorField(pagemodels.F_TEXT),
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
collection := kontaktCollection()
|
||||
if err := app.Save(collection); err != nil {
|
||||
app.Logger().Error("Failed to save collection:", "error", err, "collection", collection)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId(
|
||||
pagemodels.GeneratePageTableName(pagemodels.P_KONTAKT_NAME))
|
||||
if err == nil && collection != nil {
|
||||
if err := app.Delete(collection); err != nil {
|
||||
app.Logger().Error("Failed to delete collection:", "error", err, "collection", collection)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func kontaktCollection() *core.Collection {
|
||||
c := pagemodels.BasePageCollection(pagemodels.P_KONTAKT_NAME)
|
||||
c.Fields = append(c.Fields, kontakt_fields...)
|
||||
return c
|
||||
}
|
||||
Reference in New Issue
Block a user