feat(job): support templ command

This commit is contained in:
SG Command
2026-09-08 06:17:45 +02:00
parent cdd066dafe
commit 3d57c947cd
4 changed files with 170 additions and 12 deletions
+10 -1
View File
@@ -25,9 +25,10 @@ means adding a vetted adapter in the RelSpec source.
| `convert` | read one or more input schemas, additively merge them, write one output |
| `merge` | like `convert` but requires ≥2 inputs and exposes `skip_*` merge options |
| `scripts-list` | deterministically list SQL scripts across one or more directories |
| `templ` | apply a custom Go text template to one or more input schemas |
Deferred (documented, not implemented here): `scripts` execution against a live
database, `split`, `inspect`, `diff`, `templ`, job-to-job output wiring,
database, `split`, `inspect`, `diff`, job-to-job output wiring,
log rotation/retention. Live SQL execution already exists as
`relspec scripts execute`; wiring it into the job runner is a follow-up because
it needs live database credentials and cannot be covered by offline tests.
@@ -123,6 +124,9 @@ jobs:
script_dirs: # scripts-list (≥1)
- migrations/core
- migrations/tenant
template: templates/schema.tmpl # templ (required)
mode: table # templ: database/schema/script/table
filename_pattern: "{{.Name}}.go" # templ multi-output modes
output: # convert / merge (required)
format: pgsql
path: build/schema.sql # file output, OR:
@@ -141,6 +145,11 @@ jobs:
logfile: .relspec/log/<job-name>.log # optional; appended to
```
For `templ`, `inputs` use the same file or `pgsql`/`conn_env` source forms as
schema conversion. `output` is optional (empty means stdout); when present it
contains only `path` and `overwrite`, because templates do not select a schema
writer format.
### Supported input formats
`dbml`, `dctx`, `drawdb`, `graphql`, `json`, `yaml`, `gorm`, `bun`, `drizzle`,