mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 13:27:34 +00:00
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:
@@ -19,6 +19,7 @@ var (
|
||||
|
||||
type Config struct {
|
||||
*pgxpool.Config
|
||||
*pgxpool.Pool
|
||||
|
||||
// Host string
|
||||
// Port int32
|
||||
@@ -37,7 +38,7 @@ type Config struct {
|
||||
|
||||
// Connect implements [database.Connector].
|
||||
func (c *Config) Connect(ctx context.Context) (database.Pool, error) {
|
||||
pool, err := pgxpool.NewWithConfig(ctx, c.Config)
|
||||
pool, err := c.getPool(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -47,6 +48,13 @@ func (c *Config) Connect(ctx context.Context) (database.Pool, error) {
|
||||
return &pgxPool{pool}, nil
|
||||
}
|
||||
|
||||
func (c *Config) getPool(ctx context.Context) (*pgxpool.Pool, error) {
|
||||
if c.Pool != nil {
|
||||
return c.Pool, nil
|
||||
}
|
||||
return pgxpool.NewWithConfig(ctx, c.Config)
|
||||
}
|
||||
|
||||
func NameMatcher(name string) bool {
|
||||
return slices.Contains([]string{"postgres", "pg"}, strings.ToLower(name))
|
||||
}
|
||||
|
Reference in New Issue
Block a user