rust-lang / triagebot

Automation/tooling for Rust spaces
https://triage.rust-lang.org
Apache License 2.0
169 stars 75 forks source link

Fix DB schema migrations #1797

Closed apiraino closed 1 month ago

apiraino commented 2 months ago

r? @jackh726

jackh726 commented 2 months ago

I think we should get eyes on this from @Mark-Simulacrum as I'm not very familiar with how migrations work and what the current state of the db is.

ehuss commented 2 months ago

Will this fix the errors about function sort(integer[]) does not exist?

apiraino commented 2 months ago

Will this fix the errors about function sort(integer[]) does not exist?

@ehuss Yes and now I know why. Without this patch the migration would fail:

$ cargo run --bin triagebot
...
Failed to run server: database migrations

Caused by:
    0: executing 12th migration
    1: db error: ERROR: cannot insert multiple commands into a prepared statement
    2: ERROR: cannot insert multiple commands into a prepared statement

unsure why it didn't happen (or wasn't catched) during the triagebot deployment at the time :man_shrugging:

(I probably missed that on my local workstation because I manually fiddled with the DB schema without proberly testing the migration process)

EDIT: and that error we see in triagebot logs is triggered when from Zulip I request my PR work queue