mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 15:49:35 +00:00
feat: add task queue (#9321)
# Which Problems Are Solved To integrate river as a task queue we need to ensure the migrations of river are executed. # How the Problems Are Solved - A new schema was added to the Zitadel database called "queue" - Added a repeatable setup step to Zitadel which executes the [migrations of river](https://riverqueue.com/docs/migrations#go-migration-api). # Additional Changes - Added more hooks to the databases to properly set the schema for the task queue # Additional Context - Closes https://github.com/zitadel/zitadel/issues/9280
This commit is contained in:
28
cmd/setup/48_river_queue_repeatable.go
Normal file
28
cmd/setup/48_river_queue_repeatable.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package setup
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/database"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/queue"
|
||||
)
|
||||
|
||||
type RiverMigrateRepeatable struct {
|
||||
client *database.DB
|
||||
}
|
||||
|
||||
func (mig *RiverMigrateRepeatable) Execute(ctx context.Context, _ eventstore.Event) error {
|
||||
if mig.client.Type() != "postgres" {
|
||||
return nil
|
||||
}
|
||||
return queue.New(mig.client).ExecuteMigrations(ctx)
|
||||
}
|
||||
|
||||
func (mig *RiverMigrateRepeatable) String() string {
|
||||
return "repeatable_migrate_river"
|
||||
}
|
||||
|
||||
func (f *RiverMigrateRepeatable) Check(lastRun map[string]interface{}) bool {
|
||||
return true
|
||||
}
|
@@ -199,6 +199,9 @@ func Setup(ctx context.Context, config *Config, steps *Steps, masterKey string)
|
||||
eventstore: eventstoreClient,
|
||||
rolePermissionMappings: config.InternalAuthZ.RolePermissionMappings,
|
||||
},
|
||||
&RiverMigrateRepeatable{
|
||||
client: dbClient,
|
||||
},
|
||||
}
|
||||
|
||||
for _, step := range []migration.Migration{
|
||||
|
Reference in New Issue
Block a user