mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 13:52:51 +00:00
adds possibilities to cap authenticated requests and execution seconds of actions on a defined intervall
33 lines
658 B
Go
33 lines
658 B
Go
package setup
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
_ "embed"
|
|
"strings"
|
|
)
|
|
|
|
var (
|
|
//go:embed 07/logstore.sql
|
|
createLogstoreSchema07 string
|
|
//go:embed 07/access.sql
|
|
createAccessLogsTable07 string
|
|
//go:embed 07/execution.sql
|
|
createExecutionLogsTable07 string
|
|
)
|
|
|
|
type LogstoreTables struct {
|
|
dbClient *sql.DB
|
|
username string
|
|
}
|
|
|
|
func (mig *LogstoreTables) Execute(ctx context.Context) error {
|
|
stmt := strings.ReplaceAll(createLogstoreSchema07, "%[1]s", mig.username) + createAccessLogsTable07 + createExecutionLogsTable07
|
|
_, err := mig.dbClient.ExecContext(ctx, stmt)
|
|
return err
|
|
}
|
|
|
|
func (mig *LogstoreTables) String() string {
|
|
return "07_logstore"
|
|
}
|