Skip to content

Commit

Permalink
Merge pull request #147 from itsumura-h/fix/discard_jsonnode
Browse files Browse the repository at this point in the history
drop table {tableName} CASCADE
  • Loading branch information
itsumura-h authored Jun 13, 2021
2 parents 6e10119 + afbafac commit e771c40
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}"
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 e771c40

Please sign in to comment.