mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-09 08:42:49 +01:00
feat: scheduler (#1108)
This commit is contained in:
28
migrations/9_reactions_update.go
Normal file
28
migrations/9_reactions_update.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
"github.com/pocketbase/pocketbase/models/schema"
|
||||
)
|
||||
|
||||
func reactionsUpdateUp(db dbx.Builder) error {
|
||||
dao := daos.New(db)
|
||||
|
||||
triggers := []string{"webhook", "hook", "schedule"}
|
||||
|
||||
col, err := dao.FindCollectionByNameOrId(ReactionCollectionName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to find collection %s: %w", ReactionCollectionName, err)
|
||||
}
|
||||
|
||||
field := col.Schema.GetFieldByName("trigger")
|
||||
|
||||
field.Options = &schema.SelectOptions{MaxSelect: 1, Values: triggers}
|
||||
|
||||
col.Schema.AddField(field)
|
||||
|
||||
return dao.SaveCollection(col)
|
||||
}
|
||||
@@ -13,4 +13,5 @@ func Register() {
|
||||
migrations.Register(systemuserUp, systemuserDown, "1700000006_systemuser.go")
|
||||
migrations.Register(searchViewUp, searchViewDown, "1700000007_search_view.go")
|
||||
migrations.Register(dashboardCountsViewUpdateUp, dashboardCountsViewUpdateDown, "1700000008_dashboardview.go")
|
||||
migrations.Register(reactionsUpdateUp, nil, "1700000009_reactions_update.go")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user