ENUM options fix (#53)

This commit is contained in:
Mark Cheese 2020-04-03 22:44:05 -04:00 committed by GitHub
parent 26650c1a05
commit 0b46d58d29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,6 +120,8 @@ def get_query_from_dict(tables, distro):
else: else:
q += " id INTEGER PRIMARY KEY AUTO_INCREMENT,\n" q += " id INTEGER PRIMARY KEY AUTO_INCREMENT,\n"
for colName in sorted(tableData.keys()): for colName in sorted(tableData.keys()):
if tableData[colName]["type"] == "ENUM" and not "options" in tableData[colName]:
tableData[colName]["type"] = "TEXT"
q += f" {colName} {tableData[colName]['type']}" q += f" {colName} {tableData[colName]['type']}"
if tableData[colName]["type"] == "ENUM": if tableData[colName]["type"] == "ENUM":
q += "('" + "', '".join(tableData[colName]["options"]) + "')" q += "('" + "', '".join(tableData[colName]["options"]) + "')"