diff --git a/app/database/migrations/2026_07_31_120000_add_manual_testing_and_kp_stages.php b/app/database/migrations/2026_07_31_120000_add_manual_testing_and_kp_stages.php new file mode 100644 index 00000000..114e2cd0 --- /dev/null +++ b/app/database/migrations/2026_07_31_120000_add_manual_testing_and_kp_stages.php @@ -0,0 +1,75 @@ +statement('ALTER TABLE sales_prospects DROP CONSTRAINT IF EXISTS sales_prospects_stage_check'); + $db->statement(<<<'SQL' + ALTER TABLE sales_prospects ADD CONSTRAINT sales_prospects_stage_check + CHECK (stage IN ('new','in_work','negotiation','manual_testing','registered', + 'testing','topped_up','user','kp_sent','rejected','no_answer')) + SQL); + + $db->statement('ALTER TABLE sales_prospects ADD COLUMN IF NOT EXISTS test_channel VARCHAR(8) NULL'); + $db->statement('ALTER TABLE sales_prospects ADD COLUMN IF NOT EXISTS test_target VARCHAR(500) NULL'); + $db->statement('ALTER TABLE sales_prospects ADD COLUMN IF NOT EXISTS kp_channel VARCHAR(16) NULL'); + $db->statement('ALTER TABLE sales_prospects ADD COLUMN IF NOT EXISTS kp_target VARCHAR(500) NULL'); + + $db->statement('ALTER TABLE sales_prospects DROP CONSTRAINT IF EXISTS sales_prospects_test_channel_check'); + $db->statement(<<<'SQL' + ALTER TABLE sales_prospects ADD CONSTRAINT sales_prospects_test_channel_check + CHECK (test_channel IS NULL OR test_channel IN ('phone','site')) + SQL); + + $db->statement('ALTER TABLE sales_prospects DROP CONSTRAINT IF EXISTS sales_prospects_kp_channel_check'); + $db->statement(<<<'SQL' + ALTER TABLE sales_prospects ADD CONSTRAINT sales_prospects_kp_channel_check + CHECK (kp_channel IS NULL OR kp_channel IN ('email','whatsapp','telegram','max','other')) + SQL); + } + + public function down(): void + { + $db = DB::connection('pgsql_supplier'); + + $db->statement('ALTER TABLE sales_prospects DROP CONSTRAINT IF EXISTS sales_prospects_kp_channel_check'); + $db->statement('ALTER TABLE sales_prospects DROP CONSTRAINT IF EXISTS sales_prospects_test_channel_check'); + $db->statement('ALTER TABLE sales_prospects DROP COLUMN IF EXISTS kp_target'); + $db->statement('ALTER TABLE sales_prospects DROP COLUMN IF EXISTS kp_channel'); + $db->statement('ALTER TABLE sales_prospects DROP COLUMN IF EXISTS test_target'); + $db->statement('ALTER TABLE sales_prospects DROP COLUMN IF EXISTS test_channel'); + + // Карточки с новых стадий — в «Переговоры», иначе прежний CHECK не встанет. + $db->statement(<<<'SQL' + UPDATE sales_prospects SET stage = 'negotiation' + WHERE stage IN ('manual_testing','kp_sent') + SQL); + $db->statement('ALTER TABLE sales_prospects DROP CONSTRAINT IF EXISTS sales_prospects_stage_check'); + $db->statement(<<<'SQL' + ALTER TABLE sales_prospects ADD CONSTRAINT sales_prospects_stage_check + CHECK (stage IN ('new','in_work','negotiation','registered','testing', + 'topped_up','user','rejected','no_answer')) + SQL); + } +}; diff --git a/docs/observer/STATUS.md b/docs/observer/STATUS.md index a03dd82b..34000cb5 100644 --- a/docs/observer/STATUS.md +++ b/docs/observer/STATUS.md @@ -1,6 +1,6 @@ # Brain Status (auto-generated) -Last updated: 2026-07-31T07:17:07.339Z +Last updated: 2026-07-31T07:18:39.591Z | Контролёр | Состояние | Детали | |---|---|---| @@ -112,9 +112,9 @@ Episodes since last run: 542 / threshold: 10 | PID | Имя | CPU-время | Возраст | |---|---|---|---| -| 3544 | MsMpEng | 16.60ч | NaNч | -| 23936 | Code | 4.75ч | 14477457.8ч | -| 4 | System | 2.51ч | 1328719.3ч | +| 3544 | MsMpEng | 16.63ч | NaNч | +| 23936 | Code | 4.77ч | 0.0ч | +| 4 | System | 2.52ч | 0.0ч | ⚠️ Проверь, не «осиротевшие» ли это процессы от завершённых Claude-сессий.