Skip to content

Commit

Permalink
Try except migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
Saverio976 committed Nov 25, 2024
1 parent 6df6aec commit 2613d25
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions worldtimezone/extensions/world_clock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class DBGuild(DBBaseModel):
discord_id = peewee.CharField(unique=True)
channel_id = peewee.CharField(default="")
message_id = peewee.CharField(default="")
message_id_others = ArrayField(default=[])


class DBMember(DBBaseModel):
Expand All @@ -81,9 +82,14 @@ def __init__(self):
_ = db.connect()
db.create_tables([DBGuild, DBMember])
message_id_others = ArrayField(default=[])
migrate(
db_migrator.add_column(DBGuild._meta.table_name, "message_id_others", message_id_others)
)
try:
migrate(
db_migrator.add_column(
DBGuild._meta.table_name, "message_id_others", message_id_others
)
)
except peewee.OperationalError:
pass
# START Transform old format to new
if os.path.isfile(FILE_INFO_V2):
import json
Expand Down

0 comments on commit 2613d25

Please sign in to comment.