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