2022-11-04 10:21:58 +01:00
|
|
|
package setup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
"github.com/zitadel/zitadel/internal/query/projection"
|
|
|
|
)
|
|
|
|
|
|
|
|
type projectionTables struct {
|
2024-01-05 10:01:48 +01:00
|
|
|
es *eventstore.Eventstore
|
2022-11-04 10:21:58 +01:00
|
|
|
|
|
|
|
Version string `json:"version"`
|
|
|
|
}
|
|
|
|
|
2024-01-05 10:01:48 +01:00
|
|
|
func (mig *projectionTables) Check(lastRun map[string]interface{}) bool {
|
|
|
|
currentVersion, _ := lastRun["version"].(string)
|
|
|
|
return currentVersion != mig.Version
|
2022-11-04 10:21:58 +01:00
|
|
|
}
|
|
|
|
|
2024-01-25 17:28:20 +01:00
|
|
|
func (mig *projectionTables) Execute(ctx context.Context, _ eventstore.Event) error {
|
2022-11-04 10:21:58 +01:00
|
|
|
return projection.Init(ctx)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mig *projectionTables) String() string {
|
|
|
|
return "projection_tables"
|
|
|
|
}
|