pipekit/config/modules/rm30101.sql
Paul Trowbridge dd9f89f4b5 feat: version-control pipeline definitions via export/apply
Add `pipekit export` / `pipekit apply` (pipekit/config_io.py) to serialise the
DB's config — drivers, connections, modules (+ columns, watermarks, hooks),
groups, schedules — to a git-trackable text tree under config/, and rehydrate
it. SQLite stays runtime state; definitions become diffable/reviewable/
revertible.

- config only: run_log/group_run/settings and per-run state columns excluded
- name-keyed refs (portable across databases); source_query in .sql sidecars;
  columns as real JSON arrays for line-by-line diffs
- newline-normalised so CRLF-vs-LF is never a spurious change
- apply is create/update by name; child collections fully synced; top-level
  deletes gated behind --prune; --dry-run prints the plan
- round-trip is identity (export -> apply --dry-run == nothing to do)

Commits the current config/ as the first baseline, capturing the freshly
populated columns_json for rm00101/rm00301/iv00101. Documented in SPEC.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 10:56:55 -04:00

75 lines
2.0 KiB
SQL

SELECT * FROM OPENQUERY(GPSERVER, '
SELECT
RTRIM([CUSTNMBR]) AS custnmbr,
RTRIM([CPRCSTNM]) AS cprcstnm,
RTRIM([DOCNUMBR]) AS docnumbr,
RTRIM([CHEKNMBR]) AS cheknmbr,
RTRIM([BACHNUMB]) AS bachnumb,
RTRIM([BCHSOURC]) AS bchsourc,
RTRIM([TRXSORCE]) AS trxsorce,
[RMDTYPAL] AS rmdtypal,
[DUEDATE] AS duedate,
[DOCDATE] AS docdate,
[POSTDATE] AS postdate,
RTRIM([PSTUSRID]) AS pstusrid,
[GLPOSTDT] AS glpostdt,
[LSTEDTDT] AS lstedtdt,
RTRIM([LSTUSRED]) AS lstusred,
[ORTRXAMT] AS ortrxamt,
[CURTRXAM] AS curtrxam,
[SLSAMNT] AS slsamnt,
[COSTAMNT] AS costamnt,
[FRTAMNT] AS frtamnt,
[MISCAMNT] AS miscamnt,
[TAXAMNT] AS taxamnt,
[COMDLRAM] AS comdlram,
[CASHAMNT] AS cashamnt,
[DISTKNAM] AS distknam,
[DISAVAMT] AS disavamt,
[DISCRTND] AS discrtnd,
[DISCDATE] AS discdate,
[DSCDLRAM] AS dscdlram,
[DSCPCTAM] AS dscpctam,
[WROFAMNT] AS wrofamnt,
RTRIM([TRXDSCRN]) AS trxdscrn,
RTRIM([CSPORNBR]) AS cspornbr,
RTRIM([SLPRSNID]) AS slprsnid,
RTRIM([SLSTERCD]) AS slstercd,
[DINVPDOF] AS dinvpdof,
[PPSAMDED] AS ppsamded,
[GSTDSAMT] AS gstdsamt,
[DELETE1] AS delete1,
RTRIM([TAXSCHID]) AS taxschid,
RTRIM([SLSCHDID]) AS slschdid,
RTRIM([FRTSCHID]) AS frtschid,
RTRIM([MSCSCHID]) AS mscschid,
RTRIM([CURNCYID]) AS curncyid,
RTRIM([SHIPMTHD]) AS shipmthd,
RTRIM([PYMTRMID]) AS pymtrmid,
[TRDISAMT] AS trdisamt,
[NOTEINDX] AS noteindx,
[VOIDSTTS] AS voidstts,
[VOIDDATE] AS voiddate,
RTRIM([BALFWDNM]) AS balfwdnm,
[CSHRCTYP] AS cshrctyp,
[Tax_Date] AS tax_date,
[APLYWITH] AS aplywith,
[SALEDATE] AS saledate,
[CORRCTN] AS corrctn,
[SIMPLIFD] AS simplifd,
[Electronic] AS electronic,
[ECTRX] AS ectrx,
[BKTSLSAM] AS bktslsam,
[BackoutTradeDisc] AS backouttradedisc,
[BKTFRTAM] AS bktfrtam,
[BKTMSCAM] AS bktmscam,
[Factoring] AS factoring,
[DIRECTDEBIT] AS directdebit,
RTRIM([ADRSCODE]) AS adrscode,
[EFTFLAG] AS eftflag,
[DEX_ROW_TS] AS dex_row_ts,
[DEX_ROW_ID] AS dex_row_id
FROM CHG.dbo.RM30101
WHERE [DEX_ROW_TS] > ''{rm30101_ts}''
')