2025-05-26 08:20:14 +02:00
|
|
|
package setup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
_ "embed"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/backend/v3/storage/database/dialect/postgres"
|
|
|
|
"github.com/zitadel/zitadel/internal/database"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TransactionalTables struct {
|
|
|
|
dbClient *database.DB
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mig *TransactionalTables) Execute(ctx context.Context, _ eventstore.Event) error {
|
|
|
|
config := &postgres.Config{Pool: mig.dbClient.Pool}
|
|
|
|
pool, err := config.Connect(ctx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2025-05-26 09:31:45 +02:00
|
|
|
return pool.Migrate(ctx)
|
2025-05-26 08:20:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mig *TransactionalTables) String() string {
|
2025-06-13 15:03:32 +02:00
|
|
|
return "59_repeatable_transactional_tables"
|
2025-05-26 08:20:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mig *TransactionalTables) Check(lastRun map[string]interface{}) bool {
|
|
|
|
return true
|
|
|
|
}
|