Skip to content

Commit

Permalink
Correctly updated to using TEXT type. Fixed additional exceptions tha…
Browse files Browse the repository at this point in the history
…t were causing the application to stop early.
  • Loading branch information
danieljimeneznz committed Aug 7, 2019
1 parent f2f169d commit aa0e483
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ def child_page_recursive(pages, space_id, parent_page_id, table_prefix, recheck_
logger.info('Updating information in space %s for page: %s' % (
str(space_id), child_pages[child_page_id]['name']))
DatabaseAPI.delete(info_table, child_page_id)
page_content = ConfluenceAPI.get_page_content(
child_page_id)
try:
page_content = ConfluenceAPI.get_page_content(
child_page_id)
except:
logger.warning(
'child_page_recursive: Unable to get page content for: %s' % str(child_page_id))
continue

for page_info_type in pages[page_type][page_identifier]:
if page_info_type == 'pages':
Expand Down
4 changes: 2 additions & 2 deletions database/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ def create_table(cls, table_name, varchar_key=False):
cursor.execute(sql)
if cursor.fetchone() is None:
if varchar_key:
sql = "CREATE TABLE IF NOT EXISTS `" + table_name + "` (`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `parent` INT(11) UNSIGNED NOT NULL, `key` VARCHAR(512) NOT NULL, `value` VARCHAR(20000) NOT NULL DEFAULT '', `last_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), INDEX `parent__index` (`parent`))"
sql = "CREATE TABLE IF NOT EXISTS `" + table_name + "` (`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `parent` INT(11) UNSIGNED NOT NULL, `key` VARCHAR(512) NOT NULL, `value` TEXT, `last_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), INDEX `parent__index` (`parent`))"
logger.debug("create_table: Creating table: `%s` with VARCHAR(256) key" % table_name)
else:
sql = "CREATE TABLE IF NOT EXISTS `" + table_name + "` (`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `parent` INT(11) UNSIGNED NOT NULL, `key` INT(11) UNSIGNED NOT NULL, `value` VARCHAR(20000) NOT NULL DEFAULT '', `last_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), INDEX `parent__index` (`parent`), INDEX `key__index` (`key`))"
sql = "CREATE TABLE IF NOT EXISTS `" + table_name + "` (`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `parent` INT(11) UNSIGNED NOT NULL, `key` INT(11) UNSIGNED NOT NULL, `value` TEXT, `last_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), INDEX `parent__index` (`parent`), INDEX `key__index` (`key`))"
logger.debug("create_table: Creating table: `%s` with INT(11) key" % table_name)

cursor.execute(sql)
Expand Down

0 comments on commit aa0e483

Please sign in to comment.