fix: table 'overnight_bot.system_state_history' doesn't exist
Deploy / Test, build and deploy (push) Successful in 1m49s

This commit is contained in:
2026-06-08 15:47:00 +00:00
parent bbf55a064e
commit 82cd1936ea
2 changed files with 24 additions and 1 deletions
+9 -1
View File
@@ -7,7 +7,7 @@ import (
"fmt"
"time"
_ "github.com/go-sql-driver/mysql"
mysql "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"github.com/shopspring/decimal"
@@ -699,9 +699,17 @@ func (r *Repository) insertSystemStateHistory(ctx context.Context, state domain.
_, err := r.execer().ExecContext(ctx, `
INSERT INTO system_state_history (ts, state, mode, halted, halt_reason, context_json)
VALUES (UTC_TIMESTAMP(3), ?, ?, ?, ?, ?)`, state, mode, halted, nullableString(reason), contextJSON)
if isMissingTableError(err) {
return nil
}
return err
}
func isMissingTableError(err error) bool {
var mysqlErr *mysql.MySQLError
return errors.As(err, &mysqlErr) && mysqlErr.Number == 1146
}
func (r *Repository) Unhalt(ctx context.Context, reason string) error {
return r.RunInTx(ctx, func(ctx context.Context, repo repository.Repository) error {
state, halted, haltReason, err := repo.GetSystemState(ctx)