-- 38_postgres_fdw_corebank.sql
-- Banking Pattern Pack — PostgreSQL
-- Purpose: postgres_fdw to read from core banking DB.
-- 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.

-- postgres_fdw example (requires superuser to create server)
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
-- CREATE SERVER corebank FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'core.db', dbname 'core', port '5432');
-- CREATE USER MAPPING FOR CURRENT_USER SERVER corebank OPTIONS (user 'reader', password 'secret');
-- IMPORT FOREIGN SCHEMA public FROM SERVER corebank INTO bank_core;
