From ee700768d4a5ef15e39403548236a829775197ee Mon Sep 17 00:00:00 2001 From: Stephen Nwankwo Date: Sat, 4 Jul 2026 21:14:46 +0100 Subject: [PATCH] fix: resolve staging deploy failures in migration and frontend build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Migration d88681a7b3d0: drop ADK tables conditionally — they won't exist on a fresh DB, causing ProgrammingError on first deploy - widget-settings: double-cast res.data through unknown to satisfy TS strict check when extracting numeric limit fields from BusinessProfile Co-Authored-By: Claude Sonnet 4.6 --- .../alembic/versions/d88681a7b3d0_add_tier_to_plans.py | 10 ++++++---- frontend/src/app/dashboard/widget-settings/page.tsx | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/alembic/versions/d88681a7b3d0_add_tier_to_plans.py b/backend/alembic/versions/d88681a7b3d0_add_tier_to_plans.py index b33b6c4..7ef0c45 100644 --- a/backend/alembic/versions/d88681a7b3d0_add_tier_to_plans.py +++ b/backend/alembic/versions/d88681a7b3d0_add_tier_to_plans.py @@ -21,10 +21,12 @@ def upgrade() -> None: """Upgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('app_states') - op.drop_table('events') - op.drop_table('sessions') - op.drop_table('user_states') + conn = op.get_bind() + inspector = sa.inspect(conn) + existing = inspector.get_table_names() + for tbl in ('app_states', 'events', 'sessions', 'user_states'): + if tbl in existing: + op.drop_table(tbl) with op.batch_alter_table('plans', schema=None) as batch_op: batch_op.add_column(sa.Column('tier', sa.Integer(), server_default='0', nullable=False)) diff --git a/frontend/src/app/dashboard/widget-settings/page.tsx b/frontend/src/app/dashboard/widget-settings/page.tsx index 154eb6c..cb697b0 100644 --- a/frontend/src/app/dashboard/widget-settings/page.tsx +++ b/frontend/src/app/dashboard/widget-settings/page.tsx @@ -79,10 +79,11 @@ export default function WidgetSettingsPage() { const res = await getBusinessProfile(); if (res.status === 'success' && res.data) { setBusiness(res.data); + const d = res.data as unknown as Record; setLimits({ - allocated_messages_per_session: (res.data as Record).allocated_messages_per_session, - allocated_daily_sessions: (res.data as Record).allocated_daily_sessions, - allocated_whitelisted_domains: (res.data as Record).allocated_whitelisted_domains, + allocated_messages_per_session: d.allocated_messages_per_session, + allocated_daily_sessions: d.allocated_daily_sessions, + allocated_whitelisted_domains: d.allocated_whitelisted_domains, }); } } catch (e) { console.error(e); }