mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 09:23:51 +01:00
database: combine backfill queue upgrades together
This commit is contained in:
parent
df46ca99f9
commit
54f3e8a439
4 changed files with 11 additions and 18 deletions
|
@ -20,6 +20,15 @@ func init() {
|
||||||
UPDATE backfill_queue
|
UPDATE backfill_queue
|
||||||
SET dispatch_time=completed_at
|
SET dispatch_time=completed_at
|
||||||
`)
|
`)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove time_end from the backfill queue
|
||||||
|
_, err = tx.Exec(`
|
||||||
|
ALTER TABLE backfill_queue
|
||||||
|
DROP COLUMN time_end
|
||||||
|
`)
|
||||||
return err
|
return err
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package upgrades
|
|
||||||
|
|
||||||
import (
|
|
||||||
"database/sql"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
upgrades[45] = upgrade{"Add dispatch time to backfill queue", func(tx *sql.Tx, ctx context) error {
|
|
||||||
// First, add dispatch_time TIMESTAMP column
|
|
||||||
_, err := tx.Exec(`
|
|
||||||
ALTER TABLE backfill_queue
|
|
||||||
DROP COLUMN time_end
|
|
||||||
`)
|
|
||||||
return err
|
|
||||||
}}
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
upgrades[46] = upgrade{"Add inserted time to history sync message", func(tx *sql.Tx, ctx context) error {
|
upgrades[45] = upgrade{"Add inserted time to history sync message", func(tx *sql.Tx, ctx context) error {
|
||||||
// Add the inserted time TIMESTAMP column to history_sync_message
|
// Add the inserted time TIMESTAMP column to history_sync_message
|
||||||
_, err := tx.Exec(`
|
_, err := tx.Exec(`
|
||||||
ALTER TABLE history_sync_message
|
ALTER TABLE history_sync_message
|
||||||
|
|
|
@ -40,7 +40,7 @@ type upgrade struct {
|
||||||
fn upgradeFunc
|
fn upgradeFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumberOfUpgrades = 47
|
const NumberOfUpgrades = 46
|
||||||
|
|
||||||
var upgrades [NumberOfUpgrades]upgrade
|
var upgrades [NumberOfUpgrades]upgrade
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue