mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-20 23:07:33 +00:00
3a0f7ef193
* fix: ensure uniqueness * only update wrong ones * Update cmd/setup/16.go Co-authored-by: Silvan <silvan.reusser@gmail.com> --------- Co-authored-by: Silvan <silvan.reusser@gmail.com> (cherry picked from commit b5630411035acf521643a10527cf1abc89e7b9d3)
34 lines
636 B
Go
34 lines
636 B
Go
package setup
|
|
|
|
import (
|
|
"context"
|
|
_ "embed"
|
|
|
|
"github.com/zitadel/logging"
|
|
|
|
"github.com/zitadel/zitadel/internal/database"
|
|
)
|
|
|
|
var (
|
|
//go:embed 16.sql
|
|
uniqueConstraintLower string
|
|
)
|
|
|
|
type UniqueConstraintToLower struct {
|
|
dbClient *database.DB
|
|
}
|
|
|
|
func (mig *UniqueConstraintToLower) Execute(ctx context.Context) error {
|
|
res, err := mig.dbClient.ExecContext(ctx, uniqueConstraintLower)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
count, err := res.RowsAffected()
|
|
logging.WithFields("count", count).Info("unique constraints updated")
|
|
return err
|
|
}
|
|
|
|
func (mig *UniqueConstraintToLower) String() string {
|
|
return "16_unique_constraint_lower"
|
|
}
|