Skip to content

Commit

Permalink
fix: ignore pg error
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Oct 29, 2024
1 parent 6cbb2b6 commit 744002c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/storage/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ func (d *Driver) Initialize(ctx context.Context) error {

err = Migrate(ctx, d.db)
if err != nil {
constraintsFailed := postgres.ErrConstraintsFailed{}
if errors.As(err, &constraintsFailed) &&
constraintsFailed.GetConstraint() == "pg_namespace_nspname_index" {
// notes(gfyrag): Creating schema concurrently can result in a constraint violation of pg_namespace_nspname_index table.
// If we have this error, it's because a concurrent instance of the service is actually creating the schema
// I guess we can ignore the error.
return nil
}
return fmt.Errorf("migrating system store: %w", err)
}

Expand Down

0 comments on commit 744002c

Please sign in to comment.