From 52ad76e6a4f7073bfb5a9ece89c8daebcdf2bc7b Mon Sep 17 00:00:00 2001 From: win Date: Sat, 28 Mar 2026 03:25:54 +0800 Subject: [PATCH] fix: remove +migrate Down section from 081 migration The migrations runner executes the entire file content in a single transaction, so the Down section DROP statements were being executed immediately after the Up section, causing tables to be created then dropped within the same transaction. --- backend/migrations/081_create_risk_tables.sql | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/backend/migrations/081_create_risk_tables.sql b/backend/migrations/081_create_risk_tables.sql index 283d6919..0c7b313c 100644 --- a/backend/migrations/081_create_risk_tables.sql +++ b/backend/migrations/081_create_risk_tables.sql @@ -1,4 +1,3 @@ --- +migrate Up CREATE TABLE IF NOT EXISTS account_behavior_hourly ( id BIGSERIAL PRIMARY KEY, @@ -37,13 +36,3 @@ CREATE INDEX IF NOT EXISTS idx_account_risk_scores_risk_level ON account_risk_sc CREATE INDEX IF NOT EXISTS idx_account_risk_scores_risk_score ON account_risk_scores (risk_score DESC); CREATE INDEX IF NOT EXISTS idx_account_risk_scores_scored_at ON account_risk_scores (scored_at DESC); --- +migrate Down - -DROP INDEX IF EXISTS idx_account_risk_scores_scored_at; -DROP INDEX IF EXISTS idx_account_risk_scores_risk_score; -DROP INDEX IF EXISTS idx_account_risk_scores_risk_level; -DROP TABLE IF EXISTS account_risk_scores; - -DROP INDEX IF EXISTS idx_account_behavior_hourly_hour_bucket; -DROP INDEX IF EXISTS idx_account_behavior_hourly_account_id; -DROP TABLE IF EXISTS account_behavior_hourly;