Skip to content

Commit

Permalink
fix sqlite migrate (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
markus621 authored Jan 8, 2025
1 parent 4a86869 commit d798851
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions orm/sqlite_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ type _sqliteMigrateTable struct {

func (*_sqliteMigrateTable) CreateTableQuery() []string {
return []string{
"CREATE TABLE `__migrations__` (" +
"`id` int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY," +
"`name` text NOT NULL," +
"`timestamp` int unsigned NOT NULL" +
") ENGINE='InnoDB';",
`CREATE TABLE "__migrations__" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text NOT NULL,
"timestamp" integer NOT NULL
);`,
}
}

func (*_sqliteMigrateTable) CheckTableQuery() string {
return "SHOW TABLES LIKE '__migrations__';"
return `SELECT "name" FROM "sqlite_master" WHERE "type"='table' AND "name"='__migrations__';`
}

func (*_sqliteMigrateTable) CompletedQuery() string {
return "SELECT `name` FROM `__migrations__`;"
return `SELECT "name" FROM "__migrations__";`
}

func (*_sqliteMigrateTable) SaveQuery() string {
return "INSERT INTO `__migrations__` (`name`, `timestamp`) VALUES (?, ?);"
return `INSERT INTO "__migrations__" ("name", "timestamp") VALUES (?, ?);`
}

0 comments on commit d798851

Please sign in to comment.