Skip to content

Commit

Permalink
Move migration fix to the failed migration
Browse files Browse the repository at this point in the history
Moving this fix to m008 should fix the issue for anyone who has
successfully performed m007 but hit the error on m008
  • Loading branch information
kevinschaul committed Aug 19, 2023
1 parent 5d9252e commit b1ee233
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llm/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,15 @@ def m007_finish_logs_table(db):
drop={"debug"},
rename={"timestamp_utc": "datetime_utc"},
)
db["log"].transform(drop_foreign_keys=("chat_id",))
with db.conn:
db.execute("alter table log rename to logs")
db["logs"].add_foreign_key("chat_id", "logs", "id")


@migration
def m008_reply_to_id_foreign_key(db):
# Drop, then re-add chat_id foreign key after table name change
db["logs"].transform(drop_foreign_keys=("chat_id",))
db["logs"].add_foreign_key("chat_id", "logs", "id")
db["logs"].add_foreign_key("reply_to_id", "logs", "id")


Expand Down

0 comments on commit b1ee233

Please sign in to comment.