package migrations

import (
	"github.com/pocketbase/pocketbase/core"
	m "github.com/pocketbase/pocketbase/migrations"
)

const (
	colUsers = "users"
)

func init() {
	m.Register(func(app core.App) error {
		users := core.NewAuthCollection(colUsers)
		users.Fields.Add(createdUpdatedFields()...)
		return app.Save(users)
	}, func(app core.App) error {
		users, err := app.FindCollectionByNameOrId(colUsers)
		if err != nil {
			return err
		}
		return app.Delete(users)
	})
}
