Pārlūkot izejas kodu

database: combine backfill queue upgrades together

Sumner Evans 3 gadi atpakaļ
vecāks
revīzija
54f3e8a439

+ 9 - 0
database/upgrades/2022-05-12-backfillqueue-dispatch-time.go

@@ -20,6 +20,15 @@ func init() {
 			UPDATE backfill_queue
 				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
 	}}
 }

+ 0 - 16
database/upgrades/2022-05-12-backfillqueue-remove-time-end.go

@@ -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
-	}}
-}

+ 1 - 1
database/upgrades/2022-05-12-history-sync-message-add-added-timestamp.go

@@ -5,7 +5,7 @@ import (
 )
 
 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
 		_, err := tx.Exec(`
 			ALTER TABLE history_sync_message

+ 1 - 1
database/upgrades/upgrades.go

@@ -40,7 +40,7 @@ type upgrade struct {
 	fn      upgradeFunc
 }
 
-const NumberOfUpgrades = 47
+const NumberOfUpgrades = 46
 
 var upgrades [NumberOfUpgrades]upgrade