2023-02-21 14:46:47 +00:00
|
|
|
package setup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-03-01 00:11:23 +00:00
|
|
|
"embed"
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/database"
|
2023-02-21 14:46:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2023-03-01 00:11:23 +00:00
|
|
|
//go:embed 08/cockroach/08.sql
|
|
|
|
//go:embed 08/postgres/08.sql
|
|
|
|
tokenIndexes08 embed.FS
|
2023-02-21 14:46:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type AuthTokenIndexes struct {
|
2023-03-01 00:11:23 +00:00
|
|
|
dbClient *database.DB
|
2023-02-21 14:46:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mig *AuthTokenIndexes) Execute(ctx context.Context) error {
|
2023-03-01 00:11:23 +00:00
|
|
|
stmt, err := readStmt(tokenIndexes08, "08", mig.dbClient.Type(), "08.sql")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
_, err = mig.dbClient.ExecContext(ctx, stmt)
|
2023-02-21 14:46:47 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mig *AuthTokenIndexes) String() string {
|
|
|
|
return "08_auth_token_indexes"
|
|
|
|
}
|