Skip to content

Conversation

@EmmaLouise2018
Copy link
Contributor

Problem

The deployment is failing with:

column "mock_manual_approval_required" of relation "adapter_config" contains null values
[SQL: ALTER TABLE adapter_config ALTER COLUMN mock_manual_approval_required SET NOT NULL]

Root Cause

Migration e38f2f6f395a only updated rows WHERE adapter_type = 'mock':

UPDATE adapter_config SET mock_manual_approval_required = false WHERE adapter_type = 'mock'

But then set NOT NULL constraint on the entire column, leaving NULL values for non-mock adapters (GAM, Kevel, etc.).

Fix

Update ALL existing rows before setting NOT NULL:

UPDATE adapter_config SET mock_manual_approval_required = false

Migration Steps

The migration correctly follows the pattern:

  1. Add column as nullable ✅
  2. Set values for ALL rows ✅ (fixed)
  3. Make column NOT NULL ✅

This allows the migration to succeed for tenants with any adapter type.

Testing

  • Migration logic verified
  • Deployment currently blocked - needs immediate merge

Fixes: #602

The migration was failing in production with:
  column "mock_manual_approval_required" of relation "adapter_config" contains null values

Root cause: Migration only updated rows WHERE adapter_type = 'mock',
but then set NOT NULL constraint on the entire column.

Fix: Update ALL existing rows to false before setting NOT NULL.

This allows the migration to succeed for tenants with non-mock adapters (GAM, Kevel, etc.).
@EmmaLouise2018 EmmaLouise2018 merged commit 90360de into main Oct 24, 2025
8 checks passed
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
…ouise2018/fix-deployment-migration

Fix migration: Update ALL adapter_config rows, not just mock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants