mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 11:58:02 +00:00
35 lines
721 B
Go
35 lines
721 B
Go
|
package setup
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"database/sql"
|
||
|
_ "embed"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
//go:embed 01_sql/adminapi.sql
|
||
|
createAdminViews string
|
||
|
//go:embed 01_sql/auth.sql
|
||
|
createAuthViews string
|
||
|
//go:embed 01_sql/authz.sql
|
||
|
createAuthzViews string
|
||
|
//go:embed 01_sql/notification.sql
|
||
|
createNotificationViews string
|
||
|
//go:embed 01_sql/projections.sql
|
||
|
createProjections string
|
||
|
)
|
||
|
|
||
|
type ProjectionTable struct {
|
||
|
dbClient *sql.DB
|
||
|
}
|
||
|
|
||
|
func (mig *ProjectionTable) Execute(ctx context.Context) error {
|
||
|
stmt := createAdminViews + createAuthViews + createAuthzViews + createNotificationViews + createProjections
|
||
|
_, err := mig.dbClient.ExecContext(ctx, stmt)
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
func (mig *ProjectionTable) String() string {
|
||
|
return "01_tables"
|
||
|
}
|