Skip to content

Commit

Permalink
v1.1.3: Add update to rename 'desc' to 'description' in 'servers' table
Browse files Browse the repository at this point in the history
Previously, the code missed renaming the 'desc' column in the 'servers' table. This commit adds a new function `update_db_v_1_1_3` to handle this migration, ensuring the column is renamed appropriately.
  • Loading branch information
Aidaho12 committed Sep 9, 2024
1 parent 3d730ec commit ef0ce09
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/create_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def update_db_v_1_0_7_1():
def update_db_v_1_1():
try:
migrate(
migrator.rename_column('smon_status_pages', 'desc', 'description'),
migrator.rename_column('smon_agents', 'desc', 'description'),
migrator.rename_column('smon', 'desc', 'description'),
migrator.rename_column('smon_status_pages', 'style', 'custom_style'),
Expand Down Expand Up @@ -229,6 +228,20 @@ def update_db_v_1_1_3():
print("An error occurred:", e)


def update_db_v_1_1_3_1():
try:
migrate(
migrator.rename_column('smon_status_pages', 'desc', 'description')
)
except Exception as e:
if e.args[0] == 'no such column: "desc"' or str(e) == '(1060, no such column: "desc")':
print("Updating... DB has been updated to version 1.3")
elif e.args[0] == "'bool' object has no attribute 'sql'":
print("Updating... DB has been updated to version 1.3")
else:
print("An error occurred:", e)


def update_ver():
try:
Version.update(version='1.1.3').execute()
Expand All @@ -255,6 +268,7 @@ def update_all():
update_db_v_1_1()
update_db_v_1_1_2()
update_db_v_1_1_3()
update_db_v_1_1_3_1()


if __name__ == "__main__":
Expand Down

0 comments on commit ef0ce09

Please sign in to comment.