prole/prole-db/cr_prole_mssql_fdw.sql
chrisfu bcc8f23a0d Enhance secret management and k8s infrastructure
- Secret Management: Integrated AESGCM for temporary secret handling in install.py and enhanced OpenBao (Vault) support with namespace injection and additional secret paths (Grafana, Kerberos, TDE).
- Infrastructure & K8s:
    - Added Barman Object Store backup configuration (S3) to prole-db.yaml.
    - Updated Prometheus deployment with PVC and persistent configuration.
    - Updated k3s cluster/registry creation scripts.
    - Added etc/build-a-bao.sh for OpenBao setup.
- MSSQL Integration: Updated docker scripts and k8s deployments for Prole MSSQL database.
- Documentation: Added docs/PROLE-CFG-SECRETS.md explaining the new secret handling.
- General: Refined initialization scripts (init_authority.sh, init_openbao.sh, etc.) and updated the ncurses installer.
2026-02-03 22:39:50 -08:00

40 lines
1.4 KiB
SQL

CREATE EXTENSION tds_fdw;
-- GRANT USAGE ON FOREIGN DATA WRAPPER tds_fdw TO prole;
CREATE SERVER prole_mssql_db
FOREIGN DATA WRAPPER tds_fdw
OPTIONS (servername '127.0.0.1', port '1433', database 'prole', tds_version '7.4');
CREATE USER MAPPING FOR postgres SERVER prole_mssql_db OPTIONS (username 'sa', password '${OPENBAO:kv/prole/<namespace>/mssql#sa_password}');
IMPORT FOREIGN SCHEMA dbo FROM SERVER prole_mssql_db INTO public OPTIONS (import_default 'true');
CREATE FOREIGN TABLE prole_mssql_db_wells (
API VARCHAR(50),
FieldCode INT,
AreaCode INT,
PoolCode INT,
WellTypeCode VARCHAR (50),
LeaseName VARCHAR (50),
FieldName VARCHAR (50),
AreaName VARCHAR (50),
PoolName VARCHAR (50),
WellNumber VARCHAR (50),
WellStatus VARCHAR (50),
PoolWellTypeStatus VARCHAR (50),
County VARCHAR (50),
District VARCHAR (50),
Section VARCHAR (50),
SubSection VARCHAR (50),
Township VARCHAR (50),
Range VARCHAR (50),
BM VARCHAR (50),
Operatorcode VARCHAR (50),
OperatorName VARCHAR (256),
OperatorStatus VARCHAR (50),
SystemEntryDate TIMESTAMP
)
SERVER prole_mssql_db
OPTIONS (schema_name 'dbo', table_name 'wells', row_estimate_method 'showplan_all');