-- 34_partial_index_active_cards.sql
-- Banking Pattern Pack — PostgreSQL
-- Purpose: Partial index to speed active card lookups.
-- Context: Retail bank example with customers, accounts, transactions, cards, loans.
-- Date: 2025-08-18
-- Notes:
--   * Safe to read; run on a development DB.
--   * Requires: CREATE privileges; some files may need superuser for extensions.
--   * Search path set to 'bank' schema for clarity.
SET search_path = bank, public;

-- Partial index for active cards only
CREATE INDEX IF NOT EXISTS idx_cards_active_account ON bank.cards (account_id) WHERE active;
