-- Update platform_apps: add new columns, drop api_key columns (replaced by AccessToken table) -- Reference: Chatwoot platform_apps evolution -- Add new columns ALTER TABLE platform_apps ADD COLUMN IF NOT EXISTS icon VARCHAR(255); ALTER TABLE platform_apps ADD COLUMN IF NOT EXISTS url VARCHAR(512); ALTER TABLE platform_apps ADD COLUMN IF NOT EXISTS config JSONB DEFAULT '{}'; ALTER TABLE platform_apps ADD COLUMN IF NOT EXISTS active BOOLEAN DEFAULT TRUE; -- Note: type column already exists in platform_apps (VARCHAR(50) DEFAULT 'api'), so no change needed. -- Drop old api_key columns (replaced by access_tokens table) -- First drop the unique index on api_key DROP INDEX IF EXISTS idx_platform_apps_api_key; -- Then drop the columns ALTER TABLE platform_apps DROP COLUMN IF EXISTS api_key; ALTER TABLE platform_apps DROP COLUMN IF EXISTS api_key_prefix;