Skip to content

Commit

Permalink
fix for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
itsumura-h committed Jun 13, 2021
1 parent 78c9ff4 commit afbafac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/allographer/schema_builder/schema.nim
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ proc check*(this:Schema, tablesArg:varargs[Table]) =

proc schema*(tables:varargs[Table]) =
driverTypeError()
let driver = getDriver()

block:
var deleteList: seq[string]
Expand All @@ -92,7 +93,11 @@ proc schema*(tables:varargs[Table]) =
try:
var tableName = deleteList[^index]
wrapUpper(tableName)
let query = &"drop table {tableName} CASCADE"
let query =
if driver == "sqlite":
&"drop table {tableName}"
else:
&"drop table {tableName} CASCADE"
logger(query)
db.exec(sql query)
except Exception:
Expand All @@ -101,7 +106,6 @@ proc schema*(tables:varargs[Table]) =

for table in tables:
var query = ""
let driver = getDriver()
case driver:
of "sqlite":
query = sqlite_migrate.migrate(table)
Expand Down

0 comments on commit afbafac

Please sign in to comment.