From 42f59f14bf41c805ee755f2afad9ba51ebbd692e Mon Sep 17 00:00:00 2001 From: Denozordec Date: Sun, 15 Nov 2026 20:37:27 +0700 Subject: [PATCH] =?UTF-8?q?fix(db):=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=B2=20Git=20=D0=B8=D1=81=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=BD=D1=8B=D0=B5=20CRLF-=D0=B1=D0=B0=D0=B9=D1=82=D1=8B?= =?UTF-8?q?=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D0=B9=200008?= =?UTF-8?q?=E2=80=930013?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Хеши в migration-manifest.ts закреплены за CRLF-байтами; в индексе были LF-блобы из main, и на чистом чекауте проверка манифеста не прошла бы. Co-Authored-By: Claude Sonnet 5.5 --- backend/drizzle/0008_alert_outbox_outcomes.sql | 12 ++++++------ backend/drizzle/0009_alert_outbox_resolution.sql | 8 ++++---- backend/drizzle/0010_ping_measurement_known.sql | 6 +++--- .../drizzle/0011_traffic_collection_state.sql | 16 ++++++++-------- .../drizzle/0012_traffic_counter_identity.sql | 2 +- .../drizzle/0013_scheduler_retention_index.sql | 8 ++++---- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/backend/drizzle/0008_alert_outbox_outcomes.sql b/backend/drizzle/0008_alert_outbox_outcomes.sql index 60ebf17b..4f8b89a6 100644 --- a/backend/drizzle/0008_alert_outbox_outcomes.sql +++ b/backend/drizzle/0008_alert_outbox_outcomes.sql @@ -1,6 +1,6 @@ --- Захват перед POST и удержание неизвестных исходов. Исторические строки не меняются. -BEGIN; -ALTER TABLE alert_outbox DROP CONSTRAINT IF EXISTS alert_outbox_status_check; -ALTER TABLE alert_outbox ADD CONSTRAINT alert_outbox_status_check - CHECK (status IN ('pending', 'processing', 'unknown', 'sent', 'failed')); -COMMIT; +-- Захват перед POST и удержание неизвестных исходов. Исторические строки не меняются. +BEGIN; +ALTER TABLE alert_outbox DROP CONSTRAINT IF EXISTS alert_outbox_status_check; +ALTER TABLE alert_outbox ADD CONSTRAINT alert_outbox_status_check + CHECK (status IN ('pending', 'processing', 'unknown', 'sent', 'failed')); +COMMIT; diff --git a/backend/drizzle/0009_alert_outbox_resolution.sql b/backend/drizzle/0009_alert_outbox_resolution.sql index fbedccf1..f8af6ff2 100644 --- a/backend/drizzle/0009_alert_outbox_resolution.sql +++ b/backend/drizzle/0009_alert_outbox_resolution.sql @@ -1,4 +1,4 @@ -BEGIN; -ALTER TABLE alert_outbox ADD COLUMN IF NOT EXISTS resolution_version integer NOT NULL DEFAULT 0; -ALTER TABLE alert_outbox ADD CONSTRAINT alert_outbox_resolution_version_check CHECK (resolution_version >= 0); -COMMIT; +BEGIN; +ALTER TABLE alert_outbox ADD COLUMN IF NOT EXISTS resolution_version integer NOT NULL DEFAULT 0; +ALTER TABLE alert_outbox ADD CONSTRAINT alert_outbox_resolution_version_check CHECK (resolution_version >= 0); +COMMIT; diff --git a/backend/drizzle/0010_ping_measurement_known.sql b/backend/drizzle/0010_ping_measurement_known.sql index 239552e7..10a55fdc 100644 --- a/backend/drizzle/0010_ping_measurement_known.sql +++ b/backend/drizzle/0010_ping_measurement_known.sql @@ -1,3 +1,3 @@ --- A failed command is an attempt, not a measured packet-loss percentage. -ALTER TABLE uptime_probe_samples ADD COLUMN IF NOT EXISTS measurement_known BOOLEAN NOT NULL DEFAULT true; -ALTER TABLE uptime_probe_samples ADD COLUMN IF NOT EXISTS observation_error TEXT; +-- A failed command is an attempt, not a measured packet-loss percentage. +ALTER TABLE uptime_probe_samples ADD COLUMN IF NOT EXISTS measurement_known BOOLEAN NOT NULL DEFAULT true; +ALTER TABLE uptime_probe_samples ADD COLUMN IF NOT EXISTS observation_error TEXT; diff --git a/backend/drizzle/0011_traffic_collection_state.sql b/backend/drizzle/0011_traffic_collection_state.sql index f5c5245f..78331da4 100644 --- a/backend/drizzle/0011_traffic_collection_state.sql +++ b/backend/drizzle/0011_traffic_collection_state.sql @@ -1,8 +1,8 @@ -CREATE TABLE IF NOT EXISTS traffic_collection_state ( - server_id BIGINT PRIMARY KEY REFERENCES servers(id) ON DELETE CASCADE, - server_updated_at TIMESTAMPTZ NOT NULL, - last_attempt_at TIMESTAMPTZ NOT NULL, - last_succeeded_at TIMESTAMPTZ, - status TEXT NOT NULL CHECK(status IN ('pending', 'ok', 'error')), - error TEXT -); +CREATE TABLE IF NOT EXISTS traffic_collection_state ( + server_id BIGINT PRIMARY KEY REFERENCES servers(id) ON DELETE CASCADE, + server_updated_at TIMESTAMPTZ NOT NULL, + last_attempt_at TIMESTAMPTZ NOT NULL, + last_succeeded_at TIMESTAMPTZ, + status TEXT NOT NULL CHECK(status IN ('pending', 'ok', 'error')), + error TEXT +); diff --git a/backend/drizzle/0012_traffic_counter_identity.sql b/backend/drizzle/0012_traffic_counter_identity.sql index 9d48866b..dcb7de8d 100644 --- a/backend/drizzle/0012_traffic_counter_identity.sql +++ b/backend/drizzle/0012_traffic_counter_identity.sql @@ -1 +1 @@ -ALTER TABLE traffic_samples ADD COLUMN IF NOT EXISTS native_counter_identity TEXT; +ALTER TABLE traffic_samples ADD COLUMN IF NOT EXISTS native_counter_identity TEXT; diff --git a/backend/drizzle/0013_scheduler_retention_index.sql b/backend/drizzle/0013_scheduler_retention_index.sql index ec1ef14d..a0e12c57 100644 --- a/backend/drizzle/0013_scheduler_retention_index.sql +++ b/backend/drizzle/0013_scheduler_retention_index.sql @@ -1,4 +1,4 @@ --- Retention runs after each scheduler receipt; avoid scanning the complete history. --- On a busy existing installation, pre-create this same index CONCURRENTLY --- outside a transaction before deploying (deploy/PRODUCTION-RETENTION-INDEX.md). -CREATE INDEX IF NOT EXISTS idx_scheduler_runs_finished_at ON scheduler_runs (finished_at); +-- Retention runs after each scheduler receipt; avoid scanning the complete history. +-- On a busy existing installation, pre-create this same index CONCURRENTLY +-- outside a transaction before deploying (deploy/PRODUCTION-RETENTION-INDEX.md). +CREATE INDEX IF NOT EXISTS idx_scheduler_runs_finished_at ON scheduler_runs (finished_at);