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 51f8cd7 commit 3d730ec
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 @@ -175,7 +175,6 @@ def update_db_v_1_1():
migrate(
migrator.rename_column('smon_status_pages', 'desc', 'description'),
migrator.rename_column('smon_agents', 'desc', 'description'),
migrator.rename_column('servers', 'desc', 'description'),
migrator.rename_column('smon', 'desc', 'description'),
migrator.rename_column('smon_status_pages', 'style', 'custom_style'),
migrator.rename_column('smon_status_pages', 'desc', 'description'),
Expand Down Expand Up @@ -216,6 +215,20 @@ def update_db_v_1_1_2():
print("An error occurred:", e)


def update_db_v_1_1_3():
try:
migrate(
migrator.rename_column('servers', '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 @@ -241,6 +254,7 @@ def update_all():
update_db_v_1_0_7_1()
update_db_v_1_1()
update_db_v_1_1_2()
update_db_v_1_1_3()


if __name__ == "__main__":
Expand Down

0 comments on commit 3d730ec

Please sign in to comment.