Skip table creation on error

This commit is contained in:
shortcutme 2018-10-15 13:01:17 +02:00
parent 1aa741a25b
commit f275ba36a1
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -208,12 +208,15 @@ class Db(object):
# Check schema tables
for table_name, table_settings in self.schema.get("tables", {}).items():
changed = cur.needTable(
table_name, table_settings["cols"],
table_settings.get("indexes", []), version=table_settings.get("schema_changed", 0)
)
if changed:
changed_tables.append(table_name)
try:
changed = cur.needTable(
table_name, table_settings["cols"],
table_settings.get("indexes", []), version=table_settings.get("schema_changed", 0)
)
if changed:
changed_tables.append(table_name)
except Exception as err:
self.log.error("Error creating table %s: %s" % (table_name, Debug.formatException(err)))
cur.execute("COMMIT")
self.log.debug("Db check done in %.3fs, changed tables: %s" % (time.time() - s, changed_tables))