Skip to content

Commit 5ae6ff7

Browse files
committed
fixed 'CreateTablesIfNotExists' error logic
1 parent f6e5886 commit 5ae6ff7

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

migrate.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,11 +747,15 @@ Check https://github.com/go-sql-driver/mysql#parsetime for more info.`)
747747
}
748748

749749
err := dbMap.CreateTablesIfNotExists()
750-
// Oracle database does not support `if not exists`, so use `ORA-00955:` error code
751-
// to check if the table exists.
752-
if err != nil && dialect == "oci8" && !strings.HasPrefix(err.Error(), "ORA-00955:") {
750+
if err != nil {
751+
// Oracle database does not support `if not exists`, so use `ORA-00955:` error code
752+
// to check if the table exists.
753+
if dialect == "oci8" && strings.HasPrefix(err.Error(), "ORA-00955:") {
754+
return dbMap, nil
755+
}
753756
return nil, err
754757
}
758+
755759
return dbMap, nil
756760
}
757761

0 commit comments

Comments
 (0)