ALTER TABLE integration_hooks ADD COLUMN IF NOT EXISTS app_id VARCHAR(100), ADD COLUMN IF NOT EXISTS reference_id VARCHAR(255); UPDATE integration_hooks SET app_id = hook_type WHERE app_id IS NULL OR app_id = ''; CREATE INDEX IF NOT EXISTS idx_integration_hooks_app_id ON integration_hooks(app_id) WHERE deleted_at IS NULL; INSERT INTO integration_apps (name, description, hook_type, icon, action_url, enabled) VALUES ('Dashboard Apps', 'Embed custom dashboard apps in the conversation sidebar', 'dashboard_apps', '/assets/integrations/dashboard_apps.svg', '', TRUE), ('OpenAI', 'Connect OpenAI for label suggestions and AI-assisted workflows', 'openai', '/assets/integrations/openai.svg', '/openai', TRUE), ('Dialogflow', 'Connect Dialogflow agents to inboxes', 'dialogflow', '/assets/integrations/dialogflow.svg', '/dialogflow', TRUE), ('Google Translate', 'Connect Google Translate for message translation', 'google_translate', '/assets/integrations/google-translate.svg', '/google_translate', TRUE), ('Dyte', 'Connect Dyte for video meetings', 'dyte', '/assets/integrations/dyte.svg', '/dyte', TRUE), ('LeadSquared', 'Connect LeadSquared CRM activity sync', 'leadsquared', '/assets/integrations/leadsquared.svg', '/leadsquared', TRUE) ON CONFLICT (hook_type) DO UPDATE SET name = EXCLUDED.name, description = EXCLUDED.description, icon = EXCLUDED.icon, action_url = EXCLUDED.action_url, enabled = EXCLUDED.enabled, updated_at = NOW();