Skip to content

Commit ba2b119

Browse files
committed
fix ORA-00922 issue - missing or invalid option in database oracle
Signed-off-by: luoji <gunsluo@gmail.com>
1 parent c8d4be6 commit ba2b119

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

migrate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,10 @@ func (ms MigrationSet) ExecMax(db *sql.DB, dialect string, m MigrationSource, di
457457
}
458458

459459
for _, stmt := range migration.Queries {
460+
// remove the semicolon from stmt, fix ORA-00922 issue in database oracle
461+
stmt = strings.TrimSuffix(stmt, "\n")
462+
stmt = strings.TrimSuffix(stmt, " ")
463+
stmt = strings.TrimSuffix(stmt, ";")
460464
if _, err := executor.Exec(stmt); err != nil {
461465
if trans, ok := executor.(*gorp.Transaction); ok {
462466
_ = trans.Rollback()

0 commit comments

Comments
 (0)