Skip to content

Commit

Permalink
Account for lower and upper UNIQUE keyword in SQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Sep 20, 2022
1 parent ef99365 commit b077e93
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dbs/migration_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (r *MigrationBlocks) Insert(tx *sql.Tx) error {
r.LAST_MODIFICATION_DATE,
r.LAST_MODIFIED_BY)
if err != nil {
if strings.Contains(err.Error(), "unique") {
if strings.Contains(strings.ToLower(err.Error()), "unique") {
// if we try to insert the same migration input we'll continue
log.Printf("warning: skip %+v since it is already inserted in another request, error=%v", r, err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion dbs/migration_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (r *MigrationRequest) Insert(tx *sql.Tx) error {
r.LAST_MODIFIED_BY,
r.RETRY_COUNT)
if err != nil {
if strings.Contains(err.Error(), "unique") {
if strings.Contains(strings.ToLower(err.Error()), "unique") {
// if we try to insert the same migration input we'll continue
log.Printf("warning: skip %+v since it is already inserted in another request, error %v", r, err)
return nil
Expand Down

0 comments on commit b077e93

Please sign in to comment.