-- Add is_archived column to bank_connection_read_models table
-- This allows users to hide old/unused bank connections from the UI

ALTER TABLE bank_connection_read_models
ADD COLUMN IF NOT EXISTS is_archived BOOLEAN NOT NULL DEFAULT FALSE;

-- Create index for efficient filtering of non-archived connections
CREATE INDEX IF NOT EXISTS idx_bank_connection_read_models_company_archived
ON bank_connection_read_models (company_id, is_archived)
WHERE is_archived = FALSE;
