Skip to content

Commit

Permalink
Fix dbhacks.go ALERT TABLE typo
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp committed Jan 24, 2025
1 parent 655e4cb commit 8da5567
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dbhacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func (d db) rewriteSQL(req string) (res string) {
}
}
res = strings.TrimLeft(res, "\n\t")
if strings.HasPrefix(res, "CREATE TABLE") || strings.HasPrefix(res, "ALERT TABLE") {
if strings.HasPrefix(res, "CREATE TABLE") || strings.HasPrefix(res, "ALTER TABLE") {
res = strings.Replace(res, "BLOB", "BYTEA", -1)
res = strings.Replace(res, "LONGTEXT", "BYTEA", -1)
res = strings.Replace(res, "AUTOINCREMENT", "", -1)
}
} else if d.driver == "mysql" {
if strings.HasPrefix(res, "CREATE TABLE") || strings.HasPrefix(res, "ALERT TABLE") {
if strings.HasPrefix(res, "CREATE TABLE") || strings.HasPrefix(res, "ALTER TABLE") {
res = strings.Replace(res, "BIGSERIAL", "BIGINT", -1)
res = strings.Replace(res, "AUTOINCREMENT", "AUTO_INCREMENT", -1)
}
Expand All @@ -79,7 +79,7 @@ func (d db) rewriteSQL(req string) (res string) {
res = strings.Replace(res, "INSERT", "INSERT IGNORE", 1)
}
} else if d.driver == "sqlite3" || d.driver == "sqlite" {
if strings.HasPrefix(res, "CREATE TABLE") || strings.HasPrefix(res, "ALERT TABLE") {
if strings.HasPrefix(res, "CREATE TABLE") || strings.HasPrefix(res, "ALTER TABLE") {
res = strings.Replace(res, "BIGSERIAL", "INTEGER", -1)
}
if strings.HasSuffix(res, "ON CONFLICT DO NOTHING") && strings.HasPrefix(res, "INSERT") {
Expand Down

0 comments on commit 8da5567

Please sign in to comment.