feat: init migrations for transactional tables (#9946)

# Which Problems Are Solved

To start with transactional tables we need to setup the new `zitadel`
schema in a way that does not rely on the event store later.

# How the Problems Are Solved

Setup step added which calls the function which executes the migrations.

# Additional Changes

none

# Additional Context

- closes #9933
This commit is contained in:
Silvan
2025-05-26 08:20:14 +02:00
committed by GitHub
parent 3ddecca600
commit 362420f62b
16 changed files with 197 additions and 36 deletions

View File

@@ -6,11 +6,15 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
"github.com/zitadel/zitadel/backend/v3/storage/database"
"github.com/zitadel/zitadel/backend/v3/storage/database/dialect/postgres/migration"
)
type pgxPool struct{ *pgxpool.Pool }
var _ database.Pool = (*pgxPool)(nil)
var (
_ database.Pool = (*pgxPool)(nil)
_ database.Migrator = (*pgxPool)(nil)
)
// Acquire implements [database.Pool].
func (c *pgxPool) Acquire(ctx context.Context) (database.Client, error) {
@@ -55,3 +59,12 @@ func (c *pgxPool) Close(_ context.Context) error {
c.Pool.Close()
return nil
}
// Migrate implements [database.Migrator].
func (c *pgxPool) Migrate(ctx context.Context) error {
client, err := c.Pool.Acquire(ctx)
if err != nil {
return err
}
return migration.Migrate(ctx, client.Conn())
}