@intentius/sql-yodeler 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/README.md +28 -26
  2. package/dist/bin.js +15 -0
  3. package/dist/bin.js.map +1 -1
  4. package/dist/chant/apply.d.ts +9 -1
  5. package/dist/chant/apply.js +13 -1
  6. package/dist/chant/apply.js.map +1 -1
  7. package/dist/chant/build.js +7 -0
  8. package/dist/chant/build.js.map +1 -1
  9. package/dist/chant/drift.d.ts +69 -1
  10. package/dist/chant/drift.js +152 -5
  11. package/dist/chant/drift.js.map +1 -1
  12. package/dist/chant/runnable.d.ts +19 -0
  13. package/dist/chant/runnable.js +47 -0
  14. package/dist/chant/runnable.js.map +1 -0
  15. package/dist/ci/render.d.ts +289 -0
  16. package/dist/ci/render.js +688 -0
  17. package/dist/ci/render.js.map +1 -0
  18. package/dist/ci/replay.d.ts +17 -0
  19. package/dist/ci/replay.js +69 -0
  20. package/dist/ci/replay.js.map +1 -0
  21. package/dist/cli.d.ts +4 -0
  22. package/dist/cli.js +40 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/command.d.ts +6 -0
  25. package/dist/command.js.map +1 -1
  26. package/dist/commands/apply.d.ts +113 -0
  27. package/dist/commands/apply.js +376 -49
  28. package/dist/commands/apply.js.map +1 -1
  29. package/dist/commands/approve.d.ts +5 -0
  30. package/dist/commands/approve.js +155 -0
  31. package/dist/commands/approve.js.map +1 -0
  32. package/dist/commands/checkpoint.d.ts +3 -0
  33. package/dist/commands/checkpoint.js +78 -0
  34. package/dist/commands/checkpoint.js.map +1 -0
  35. package/dist/commands/ci.d.ts +3 -0
  36. package/dist/commands/ci.js +118 -0
  37. package/dist/commands/ci.js.map +1 -0
  38. package/dist/commands/docs.d.ts +11 -0
  39. package/dist/commands/docs.js +108 -0
  40. package/dist/commands/docs.js.map +1 -0
  41. package/dist/commands/drift.d.ts +23 -0
  42. package/dist/commands/drift.js +263 -18
  43. package/dist/commands/drift.js.map +1 -1
  44. package/dist/commands/index.js +16 -0
  45. package/dist/commands/index.js.map +1 -1
  46. package/dist/commands/init.d.ts +3 -0
  47. package/dist/commands/init.js +15 -11
  48. package/dist/commands/init.js.map +1 -1
  49. package/dist/commands/lint.js +25 -8
  50. package/dist/commands/lint.js.map +1 -1
  51. package/dist/commands/mcp.d.ts +3 -0
  52. package/dist/commands/mcp.js +50 -0
  53. package/dist/commands/mcp.js.map +1 -0
  54. package/dist/commands/new.d.ts +2 -0
  55. package/dist/commands/new.js +134 -10
  56. package/dist/commands/new.js.map +1 -1
  57. package/dist/commands/override.d.ts +3 -0
  58. package/dist/commands/override.js +150 -0
  59. package/dist/commands/override.js.map +1 -0
  60. package/dist/commands/plan.js +43 -27
  61. package/dist/commands/plan.js.map +1 -1
  62. package/dist/commands/repair.d.ts +11 -0
  63. package/dist/commands/repair.js +15 -7
  64. package/dist/commands/repair.js.map +1 -1
  65. package/dist/commands/report.d.ts +13 -0
  66. package/dist/commands/report.js +121 -0
  67. package/dist/commands/report.js.map +1 -0
  68. package/dist/commands/revert.d.ts +20 -0
  69. package/dist/commands/revert.js +246 -0
  70. package/dist/commands/revert.js.map +1 -0
  71. package/dist/commands/status.js +44 -17
  72. package/dist/commands/status.js.map +1 -1
  73. package/dist/config/base.d.ts +69 -0
  74. package/dist/config/base.js +121 -0
  75. package/dist/config/base.js.map +1 -0
  76. package/dist/config/define.d.ts +223 -3
  77. package/dist/config/define.js +3 -1
  78. package/dist/config/define.js.map +1 -1
  79. package/dist/config/index.d.ts +2 -0
  80. package/dist/config/index.js +2 -0
  81. package/dist/config/index.js.map +1 -1
  82. package/dist/config/load.d.ts +1 -1
  83. package/dist/config/load.js +150 -5
  84. package/dist/config/load.js.map +1 -1
  85. package/dist/config/settings.d.ts +18 -2
  86. package/dist/config/settings.js +40 -6
  87. package/dist/config/settings.js.map +1 -1
  88. package/dist/env-args.d.ts +6 -0
  89. package/dist/env-args.js +31 -1
  90. package/dist/env-args.js.map +1 -1
  91. package/dist/exit.d.ts +20 -0
  92. package/dist/exit.js +28 -0
  93. package/dist/exit.js.map +1 -0
  94. package/dist/history/client.d.ts +8 -0
  95. package/dist/history/client.js +24 -1
  96. package/dist/history/client.js.map +1 -1
  97. package/dist/history/lock.d.ts +5 -1
  98. package/dist/history/lock.js +8 -2
  99. package/dist/history/lock.js.map +1 -1
  100. package/dist/history/postgres/ddl.d.ts +18 -0
  101. package/dist/history/postgres/ddl.js +27 -2
  102. package/dist/history/postgres/ddl.js.map +1 -1
  103. package/dist/history/postgres/store.d.ts +2 -0
  104. package/dist/history/postgres/store.js +7 -1
  105. package/dist/history/postgres/store.js.map +1 -1
  106. package/dist/history/rows.d.ts +16 -3
  107. package/dist/history/rows.js +30 -1
  108. package/dist/history/rows.js.map +1 -1
  109. package/dist/history/store.d.ts +2 -0
  110. package/dist/history/store.js +2 -2
  111. package/dist/history/store.js.map +1 -1
  112. package/dist/index.d.ts +4 -1
  113. package/dist/index.js +1 -0
  114. package/dist/index.js.map +1 -1
  115. package/dist/init/adopt.js +8 -3
  116. package/dist/init/adopt.js.map +1 -1
  117. package/dist/init/live.d.ts +11 -0
  118. package/dist/init/live.js +25 -2
  119. package/dist/init/live.js.map +1 -1
  120. package/dist/lint/check.d.ts +8 -1
  121. package/dist/lint/check.js +38 -4
  122. package/dist/lint/check.js.map +1 -1
  123. package/dist/lint/report.js +1 -1
  124. package/dist/lint/report.js.map +1 -1
  125. package/dist/lint/routines.d.ts +26 -0
  126. package/dist/lint/routines.js +65 -0
  127. package/dist/lint/routines.js.map +1 -0
  128. package/dist/lint/rules.d.ts +16 -4
  129. package/dist/lint/rules.js +9 -4
  130. package/dist/lint/rules.js.map +1 -1
  131. package/dist/mcp/server.d.ts +40 -0
  132. package/dist/mcp/server.js +106 -0
  133. package/dist/mcp/server.js.map +1 -0
  134. package/dist/mcp/tools.d.ts +72 -0
  135. package/dist/mcp/tools.js +178 -0
  136. package/dist/mcp/tools.js.map +1 -0
  137. package/dist/migrations/checkpoint.d.ts +45 -0
  138. package/dist/migrations/checkpoint.js +110 -0
  139. package/dist/migrations/checkpoint.js.map +1 -0
  140. package/dist/migrations/checks.d.ts +28 -0
  141. package/dist/migrations/checks.js +97 -0
  142. package/dist/migrations/checks.js.map +1 -0
  143. package/dist/migrations/create.d.ts +3 -1
  144. package/dist/migrations/create.js +3 -0
  145. package/dist/migrations/create.js.map +1 -1
  146. package/dist/migrations/directory.js +4 -0
  147. package/dist/migrations/directory.js.map +1 -1
  148. package/dist/migrations/document.d.ts +33 -0
  149. package/dist/migrations/document.js +2 -0
  150. package/dist/migrations/document.js.map +1 -1
  151. package/dist/migrations/index.d.ts +3 -0
  152. package/dist/migrations/index.js +3 -0
  153. package/dist/migrations/index.js.map +1 -1
  154. package/dist/migrations/routines.d.ts +31 -0
  155. package/dist/migrations/routines.js +55 -0
  156. package/dist/migrations/routines.js.map +1 -0
  157. package/dist/notify/index.d.ts +124 -0
  158. package/dist/notify/index.js +210 -0
  159. package/dist/notify/index.js.map +1 -0
  160. package/dist/notify/verify.d.ts +53 -0
  161. package/dist/notify/verify.js +71 -0
  162. package/dist/notify/verify.js.map +1 -0
  163. package/dist/pr/forge.d.ts +4 -0
  164. package/dist/pr/forge.js +21 -7
  165. package/dist/pr/forge.js.map +1 -1
  166. package/dist/pr/issue.d.ts +68 -0
  167. package/dist/pr/issue.js +107 -0
  168. package/dist/pr/issue.js.map +1 -0
  169. package/dist/pr/model.d.ts +12 -1
  170. package/dist/pr/model.js +44 -6
  171. package/dist/pr/model.js.map +1 -1
  172. package/dist/pr/render.d.ts +3 -1
  173. package/dist/pr/render.js +63 -4
  174. package/dist/pr/render.js.map +1 -1
  175. package/dist/project.d.ts +19 -2
  176. package/dist/project.js +33 -1
  177. package/dist/project.js.map +1 -1
  178. package/dist/replay/index.d.ts +3 -0
  179. package/dist/replay/index.js +3 -0
  180. package/dist/replay/index.js.map +1 -1
  181. package/dist/replay/replay.d.ts +9 -1
  182. package/dist/replay/replay.js +63 -32
  183. package/dist/replay/replay.js.map +1 -1
  184. package/dist/replay/report.js +1 -1
  185. package/dist/replay/report.js.map +1 -1
  186. package/dist/replay/shared.d.ts +28 -0
  187. package/dist/replay/shared.js +77 -0
  188. package/dist/replay/shared.js.map +1 -0
  189. package/dist/report/audit.d.ts +138 -0
  190. package/dist/report/audit.js +202 -0
  191. package/dist/report/audit.js.map +1 -0
  192. package/dist/report/jsonl.d.ts +21 -0
  193. package/dist/report/jsonl.js +52 -0
  194. package/dist/report/jsonl.js.map +1 -0
  195. package/dist/report/model.d.ts +68 -0
  196. package/dist/report/model.js +127 -0
  197. package/dist/report/model.js.map +1 -0
  198. package/dist/report/render.d.ts +18 -0
  199. package/dist/report/render.js +127 -0
  200. package/dist/report/render.js.map +1 -0
  201. package/dist/schema-docs/render.d.ts +49 -0
  202. package/dist/schema-docs/render.js +359 -0
  203. package/dist/schema-docs/render.js.map +1 -0
  204. package/dist/schemas.d.ts +37 -0
  205. package/dist/schemas.js +41 -0
  206. package/dist/schemas.js.map +1 -0
  207. package/dist/server.d.ts +40 -0
  208. package/dist/server.js +87 -0
  209. package/dist/server.js.map +1 -0
  210. package/dist/sources/ddl.d.ts +53 -0
  211. package/dist/sources/ddl.js +347 -0
  212. package/dist/sources/ddl.js.map +1 -0
  213. package/dist/sources/index.d.ts +69 -0
  214. package/dist/sources/index.js +170 -0
  215. package/dist/sources/index.js.map +1 -0
  216. package/dist/steps/backfill.d.ts +21 -17
  217. package/dist/steps/backfill.js +20 -20
  218. package/dist/steps/backfill.js.map +1 -1
  219. package/dist/steps/index.d.ts +2 -2
  220. package/dist/steps/index.js +3 -3
  221. package/dist/steps/index.js.map +1 -1
  222. package/dist/steps/postgres-migration.d.ts +35 -25
  223. package/dist/steps/postgres-migration.js +42 -29
  224. package/dist/steps/postgres-migration.js.map +1 -1
  225. package/dist/steps/rebuild.d.ts +15 -15
  226. package/dist/steps/rebuild.js +17 -24
  227. package/dist/steps/rebuild.js.map +1 -1
  228. package/dist/tenants/index.d.ts +40 -0
  229. package/dist/tenants/index.js +122 -0
  230. package/dist/tenants/index.js.map +1 -0
  231. package/dist/tenants/target.d.ts +23 -0
  232. package/dist/tenants/target.js +29 -0
  233. package/dist/tenants/target.js.map +1 -0
  234. package/dist/versioned/checks.d.ts +29 -0
  235. package/dist/versioned/checks.js +54 -0
  236. package/dist/versioned/checks.js.map +1 -0
  237. package/dist/versioned/clickhouse.js +8 -0
  238. package/dist/versioned/clickhouse.js.map +1 -1
  239. package/dist/versioned/driver.d.ts +10 -0
  240. package/dist/versioned/engine.d.ts +61 -1
  241. package/dist/versioned/engine.js +109 -6
  242. package/dist/versioned/engine.js.map +1 -1
  243. package/dist/versioned/explain.js +7 -2
  244. package/dist/versioned/explain.js.map +1 -1
  245. package/dist/versioned/index.d.ts +10 -0
  246. package/dist/versioned/index.js +25 -1
  247. package/dist/versioned/index.js.map +1 -1
  248. package/dist/versioned/op.d.ts +16 -1
  249. package/dist/versioned/op.js +43 -6
  250. package/dist/versioned/op.js.map +1 -1
  251. package/dist/versioned/policy.d.ts +98 -0
  252. package/dist/versioned/policy.js +212 -0
  253. package/dist/versioned/policy.js.map +1 -0
  254. package/dist/versioned/postgres/driver.d.ts +3 -1
  255. package/dist/versioned/postgres/driver.js +30 -3
  256. package/dist/versioned/postgres/driver.js.map +1 -1
  257. package/dist/versioned/postgres/waits.d.ts +46 -0
  258. package/dist/versioned/postgres/waits.js +78 -0
  259. package/dist/versioned/postgres/waits.js.map +1 -0
  260. package/dist/versioned/report.d.ts +3 -0
  261. package/dist/versioned/report.js +13 -1
  262. package/dist/versioned/report.js.map +1 -1
  263. package/dist/versioned/revert.d.ts +128 -0
  264. package/dist/versioned/revert.js +251 -0
  265. package/dist/versioned/revert.js.map +1 -0
  266. package/dist/versioned/stand-down.d.ts +30 -0
  267. package/dist/versioned/stand-down.js +56 -0
  268. package/dist/versioned/stand-down.js.map +1 -0
  269. package/dist/versioned/state.d.ts +25 -0
  270. package/dist/versioned/state.js +36 -3
  271. package/dist/versioned/state.js.map +1 -1
  272. package/dist/waves/index.d.ts +179 -0
  273. package/dist/waves/index.js +268 -0
  274. package/dist/waves/index.js.map +1 -0
  275. package/dist/waves/promotion.d.ts +56 -0
  276. package/dist/waves/promotion.js +108 -0
  277. package/dist/waves/promotion.js.map +1 -0
  278. package/dist/waves/record.d.ts +24 -0
  279. package/dist/waves/record.js +20 -0
  280. package/dist/waves/record.js.map +1 -0
  281. package/package.json +22 -8
  282. package/schemas/apply.schema.json +428 -0
  283. package/schemas/checkpoint.schema.json +19 -0
  284. package/schemas/common.schema.json +213 -0
  285. package/schemas/drift.schema.json +61 -0
  286. package/schemas/event.schema.json +36 -0
  287. package/schemas/init.schema.json +31 -0
  288. package/schemas/lint-rules.schema.json +54 -0
  289. package/schemas/lint.schema.json +294 -0
  290. package/schemas/mcp.schema.json +70 -0
  291. package/schemas/new.schema.json +71 -0
  292. package/schemas/plan.schema.json +489 -0
  293. package/schemas/rebase.schema.json +54 -0
  294. package/schemas/repair.schema.json +20 -0
  295. package/schemas/report.schema.json +114 -0
  296. package/schemas/revert.schema.json +69 -0
  297. package/schemas/status.schema.json +371 -0
@@ -0,0 +1,428 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/apply.schema.json",
4
+ "title": "yodel apply <env> --json",
5
+ "description": "Version 1. On a project with migrations, the status (status.schema.json) with mode \"versioned\" and what apply did; with --execute (the migrations Op's Apply step) or --wave-apply (a wave job's apply), what the step applied; with --wave-plan, the wave plan it wrote; on a project without migrations, the declarative outcome with chant's plan. Within a version, fields are only added; a reader ignores fields it does not know.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "#/$defs/versioned"
9
+ },
10
+ {
11
+ "$ref": "#/$defs/execute"
12
+ },
13
+ {
14
+ "$ref": "#/$defs/wavePlan"
15
+ },
16
+ {
17
+ "$ref": "#/$defs/declarative"
18
+ }
19
+ ],
20
+ "$defs": {
21
+ "lock": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": [
25
+ "kind",
26
+ "where"
27
+ ],
28
+ "properties": {
29
+ "kind": {
30
+ "enum": [
31
+ "keeper",
32
+ "local",
33
+ "advisory"
34
+ ]
35
+ },
36
+ "where": {
37
+ "type": "string"
38
+ },
39
+ "notice": {
40
+ "type": "string"
41
+ },
42
+ "waited": {
43
+ "description": "The run waited for another apply's lock (--lock-wait): for how long, who held it when the run first found it held, and where.",
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "required": [
47
+ "ms",
48
+ "heldBy",
49
+ "where"
50
+ ],
51
+ "properties": {
52
+ "ms": {
53
+ "type": "integer"
54
+ },
55
+ "heldBy": {
56
+ "type": "string"
57
+ },
58
+ "where": {
59
+ "type": "string"
60
+ }
61
+ }
62
+ }
63
+ }
64
+ },
65
+ "versioned": {
66
+ "type": "object",
67
+ "$ref": "status.schema.json#/$defs/report",
68
+ "required": [
69
+ "mode",
70
+ "status"
71
+ ],
72
+ "unevaluatedProperties": false,
73
+ "properties": {
74
+ "mode": {
75
+ "const": "versioned"
76
+ },
77
+ "status": {
78
+ "description": "planned (--plan, something pending), unchanged, refused, denied (a policy rule denies the plan, with no override), stood-down (--stand-down: a newer commit's apply applies this environment, so this one applied nothing), gated (waiting at the Op's gate for a person's approval), failed, applied.",
79
+ "enum": [
80
+ "planned",
81
+ "unchanged",
82
+ "refused",
83
+ "denied",
84
+ "stood-down",
85
+ "gated",
86
+ "failed",
87
+ "applied"
88
+ ]
89
+ },
90
+ "stoodDown": {
91
+ "description": "stood-down: why, in one line.",
92
+ "type": "string"
93
+ },
94
+ "preChecks": {
95
+ "description": "The first pending migration's checks, when one failed before the gate.",
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": [
99
+ "migration",
100
+ "checks"
101
+ ],
102
+ "properties": {
103
+ "migration": {
104
+ "type": "string"
105
+ },
106
+ "checks": {
107
+ "type": "array",
108
+ "items": {
109
+ "$ref": "common.schema.json#/$defs/checkOutcome"
110
+ }
111
+ }
112
+ }
113
+ },
114
+ "policy": {
115
+ "description": "denied: each policy rule's outcome.",
116
+ "$ref": "common.schema.json#/$defs/policy"
117
+ },
118
+ "op": {
119
+ "type": "string"
120
+ },
121
+ "gate": {
122
+ "type": "string"
123
+ },
124
+ "approve": {
125
+ "description": "gated: the command a person runs to approve. An agent prints it and never runs it.",
126
+ "type": "string"
127
+ },
128
+ "gatePlanDigest": {
129
+ "type": "string"
130
+ },
131
+ "moved": {
132
+ "description": "gated: the gate's newest approval does not hold, and what moved since it.",
133
+ "type": "object",
134
+ "additionalProperties": false,
135
+ "required": [
136
+ "approved",
137
+ "by",
138
+ "at",
139
+ "confirmed",
140
+ "changes"
141
+ ],
142
+ "properties": {
143
+ "approved": {
144
+ "type": "string"
145
+ },
146
+ "by": {
147
+ "type": "string"
148
+ },
149
+ "at": {
150
+ "type": "string"
151
+ },
152
+ "confirmed": {
153
+ "type": "boolean"
154
+ },
155
+ "changes": {
156
+ "$ref": "plan.schema.json#/$defs/moved"
157
+ },
158
+ "askedAgain": {
159
+ "type": "object",
160
+ "additionalProperties": false,
161
+ "required": [
162
+ "at"
163
+ ],
164
+ "properties": {
165
+ "at": {
166
+ "type": "string"
167
+ },
168
+ "digest": {
169
+ "type": "string"
170
+ }
171
+ }
172
+ }
173
+ }
174
+ },
175
+ "exitCode": {
176
+ "description": "failed: yodel apply's exit code, the Apply step's own when it had one.",
177
+ "type": "integer"
178
+ },
179
+ "chantExitCode": {
180
+ "description": "failed: chant run's exit code.",
181
+ "type": "integer"
182
+ },
183
+ "appliedNow": {
184
+ "description": "applied: the migrations this run applied.",
185
+ "$ref": "common.schema.json#/$defs/stringList"
186
+ }
187
+ }
188
+ },
189
+ "execute": {
190
+ "type": "object",
191
+ "additionalProperties": false,
192
+ "required": [
193
+ "environment",
194
+ "status",
195
+ "planDigest",
196
+ "applied",
197
+ "skipped",
198
+ "lock"
199
+ ],
200
+ "properties": {
201
+ "environment": {
202
+ "type": "string"
203
+ },
204
+ "status": {
205
+ "description": "applied, or stood-down (--stand-down: a newer commit came while the step waited for the lock, and it applied nothing).",
206
+ "enum": [
207
+ "applied",
208
+ "stood-down"
209
+ ]
210
+ },
211
+ "stoodDown": {
212
+ "description": "stood-down: why, in one line.",
213
+ "type": "string"
214
+ },
215
+ "planDigest": {
216
+ "description": "The digest the gate approved.",
217
+ "type": "string"
218
+ },
219
+ "applied": {
220
+ "$ref": "common.schema.json#/$defs/stringList"
221
+ },
222
+ "skipped": {
223
+ "description": "Statements not sent because an earlier run had already succeeded with them.",
224
+ "type": "array",
225
+ "items": {
226
+ "type": "object",
227
+ "additionalProperties": false,
228
+ "required": [
229
+ "id",
230
+ "statement"
231
+ ],
232
+ "properties": {
233
+ "id": {
234
+ "type": "string"
235
+ },
236
+ "statement": {
237
+ "type": "integer"
238
+ }
239
+ }
240
+ }
241
+ },
242
+ "lock": {
243
+ "$ref": "#/$defs/lock"
244
+ },
245
+ "wavePlanDigest": {
246
+ "description": "--wave-apply: the wave plan digest chant's wave decision named.",
247
+ "type": "string"
248
+ }
249
+ }
250
+ },
251
+ "declarative": {
252
+ "type": "object",
253
+ "additionalProperties": false,
254
+ "required": [
255
+ "environment",
256
+ "dialect",
257
+ "op",
258
+ "status",
259
+ "plan"
260
+ ],
261
+ "properties": {
262
+ "environment": {
263
+ "type": "string"
264
+ },
265
+ "dialect": {
266
+ "$ref": "common.schema.json#/$defs/dialect"
267
+ },
268
+ "server": {
269
+ "$ref": "common.schema.json#/$defs/server"
270
+ },
271
+ "op": {
272
+ "description": "The ApplyOp.",
273
+ "type": "string"
274
+ },
275
+ "status": {
276
+ "enum": [
277
+ "refused",
278
+ "unchanged",
279
+ "gated",
280
+ "failed",
281
+ "incomplete",
282
+ "applied"
283
+ ]
284
+ },
285
+ "gate": {
286
+ "type": "string"
287
+ },
288
+ "approve": {
289
+ "description": "gated: the command a person runs to approve. An agent prints it and never runs it.",
290
+ "type": "string"
291
+ },
292
+ "planDigest": {
293
+ "type": "string"
294
+ },
295
+ "exitCode": {
296
+ "description": "failed: chant run's exit code.",
297
+ "type": "integer"
298
+ },
299
+ "plan": {
300
+ "description": "The plan before the run.",
301
+ "$ref": "plan.schema.json#/$defs/declarative"
302
+ },
303
+ "remaining": {
304
+ "description": "incomplete: the plan after the Op completed.",
305
+ "$ref": "plan.schema.json#/$defs/declarative"
306
+ }
307
+ }
308
+ },
309
+ "wavePlan": {
310
+ "description": "--wave-plan: the plan file chant run wave reads, as written.",
311
+ "type": "object",
312
+ "additionalProperties": false,
313
+ "required": [
314
+ "planDigest",
315
+ "destructive",
316
+ "empty",
317
+ "environment",
318
+ "migrations",
319
+ "gate",
320
+ "base",
321
+ "pending",
322
+ "destructiveSteps",
323
+ "requires"
324
+ ],
325
+ "properties": {
326
+ "planDigest": {
327
+ "description": "The wave plan digest: over the migrations' digest, the gate policy at the base commit and whether a pending step is destructive.",
328
+ "type": "string"
329
+ },
330
+ "destructive": {
331
+ "type": "boolean"
332
+ },
333
+ "empty": {
334
+ "description": "Nothing is pending.",
335
+ "type": "boolean"
336
+ },
337
+ "environment": {
338
+ "type": "string"
339
+ },
340
+ "migrations": {
341
+ "description": "The migrations' plan digest, as yodel apply --digest prints it.",
342
+ "type": "string"
343
+ },
344
+ "gate": {
345
+ "enum": [
346
+ "always",
347
+ "on-destructive",
348
+ "never"
349
+ ]
350
+ },
351
+ "base": {
352
+ "description": "The base commit the gate was read at.",
353
+ "type": "string"
354
+ },
355
+ "pending": {
356
+ "$ref": "common.schema.json#/$defs/stringList"
357
+ },
358
+ "destructiveSteps": {
359
+ "type": "array",
360
+ "items": {
361
+ "$ref": "#/$defs/destructiveStep"
362
+ }
363
+ },
364
+ "requires": {
365
+ "description": "Each environment this one requires, and the pending migrations its history records applied; part of the plan digest.",
366
+ "type": "array",
367
+ "items": {
368
+ "type": "object",
369
+ "additionalProperties": false,
370
+ "required": [
371
+ "env",
372
+ "applied"
373
+ ],
374
+ "properties": {
375
+ "env": {
376
+ "type": "string"
377
+ },
378
+ "applied": {
379
+ "type": "array",
380
+ "items": {
381
+ "type": "object",
382
+ "additionalProperties": false,
383
+ "required": [
384
+ "id",
385
+ "checksum"
386
+ ],
387
+ "properties": {
388
+ "id": {
389
+ "type": "string"
390
+ },
391
+ "checksum": {
392
+ "type": "string"
393
+ }
394
+ }
395
+ }
396
+ }
397
+ }
398
+ }
399
+ }
400
+ }
401
+ },
402
+ "destructiveStep": {
403
+ "type": "object",
404
+ "additionalProperties": false,
405
+ "required": [
406
+ "migration",
407
+ "step",
408
+ "what",
409
+ "why"
410
+ ],
411
+ "properties": {
412
+ "migration": {
413
+ "type": "string"
414
+ },
415
+ "step": {
416
+ "type": "integer"
417
+ },
418
+ "what": {
419
+ "type": "string"
420
+ },
421
+ "why": {
422
+ "description": "The lint rules that class it (destructive, pg-rewrite, pg-lock, ch-mutation, ch-rebuild), or op-step, manual-step.",
423
+ "type": "string"
424
+ }
425
+ }
426
+ }
427
+ }
428
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/checkpoint.schema.json",
4
+ "title": "yodel checkpoint <name> --json",
5
+ "description": "Version 1. The checkpoint written: its id and directory, the migration whose recorded schema it creates (its parent), its checksum, how many statements it holds, and the SHA-256 of the recorded schema it was written from. Within a version, fields are only added; a reader ignores fields it does not know.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["written", "id", "path", "parent", "checksum", "dialect", "statements", "schema"],
9
+ "properties": {
10
+ "written": { "const": true },
11
+ "id": { "type": "string" },
12
+ "path": { "type": "string" },
13
+ "parent": { "type": "string" },
14
+ "checksum": { "type": "string" },
15
+ "dialect": { "$ref": "common.schema.json#/$defs/dialect" },
16
+ "statements": { "type": "integer", "minimum": 1 },
17
+ "schema": { "type": "string" }
18
+ }
19
+ }
@@ -0,0 +1,213 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/common.schema.json",
4
+ "title": "Definitions the yodel --json schemas share",
5
+ "description": "Version 1. Shared by the other schemas in this directory; no command prints this document on its own.",
6
+ "$defs": {
7
+ "dialect": {
8
+ "enum": [
9
+ "clickhouse",
10
+ "postgres"
11
+ ]
12
+ },
13
+ "server": {
14
+ "description": "The server read from: its dialect, its address (host:port on ClickHouse, host:port/database on Postgres) and its version, when it answered.",
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": [
18
+ "dialect",
19
+ "address"
20
+ ],
21
+ "properties": {
22
+ "dialect": {
23
+ "$ref": "#/$defs/dialect"
24
+ },
25
+ "address": {
26
+ "type": "string"
27
+ },
28
+ "version": {
29
+ "type": "string"
30
+ }
31
+ }
32
+ },
33
+ "refusal": {
34
+ "description": "Why yodel apply would refuse, and the exit code it would refuse with.",
35
+ "type": "object",
36
+ "additionalProperties": false,
37
+ "required": [
38
+ "exitCode",
39
+ "message"
40
+ ],
41
+ "properties": {
42
+ "exitCode": {
43
+ "type": "integer"
44
+ },
45
+ "message": {
46
+ "type": "string"
47
+ }
48
+ }
49
+ },
50
+ "change": {
51
+ "description": "One classified change, as chant's sql lexicon reports it. chant owns this object: fields beyond the required ones may appear.",
52
+ "type": "object",
53
+ "required": [
54
+ "object",
55
+ "field",
56
+ "rule",
57
+ "class"
58
+ ],
59
+ "properties": {
60
+ "object": {
61
+ "type": "string"
62
+ },
63
+ "field": {
64
+ "type": "string"
65
+ },
66
+ "before": {
67
+ "type": "string"
68
+ },
69
+ "after": {
70
+ "type": "string"
71
+ },
72
+ "rule": {
73
+ "type": "string"
74
+ },
75
+ "class": {
76
+ "type": "string"
77
+ },
78
+ "destructive": {
79
+ "type": "boolean"
80
+ },
81
+ "note": {
82
+ "type": "string"
83
+ }
84
+ }
85
+ },
86
+ "check": {
87
+ "description": "A pre-migration check from migration.json.",
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": [
91
+ "name",
92
+ "sql"
93
+ ],
94
+ "properties": {
95
+ "name": {
96
+ "type": "string"
97
+ },
98
+ "sql": {
99
+ "type": "string"
100
+ },
101
+ "expect": {
102
+ "oneOf": [
103
+ {
104
+ "enum": [
105
+ "empty",
106
+ "true"
107
+ ]
108
+ },
109
+ {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "properties": {
113
+ "min": {
114
+ "type": "number"
115
+ },
116
+ "max": {
117
+ "type": "number"
118
+ }
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ },
125
+ "checkOutcome": {
126
+ "type": "object",
127
+ "additionalProperties": false,
128
+ "required": [
129
+ "name",
130
+ "passed",
131
+ "detail"
132
+ ],
133
+ "properties": {
134
+ "name": {
135
+ "type": "string"
136
+ },
137
+ "passed": {
138
+ "type": "boolean"
139
+ },
140
+ "detail": {
141
+ "type": "string"
142
+ }
143
+ }
144
+ },
145
+ "stringList": {
146
+ "type": "array",
147
+ "items": {
148
+ "type": "string"
149
+ }
150
+ },
151
+ "policy": {
152
+ "description": "The outcome of each rule of yodel.config.ts policy.rules over the plan.",
153
+ "type": "array",
154
+ "items": {
155
+ "type": "object",
156
+ "additionalProperties": false,
157
+ "required": [
158
+ "id",
159
+ "outcome",
160
+ "reasons"
161
+ ],
162
+ "properties": {
163
+ "id": {
164
+ "type": "string"
165
+ },
166
+ "description": {
167
+ "type": "string"
168
+ },
169
+ "outcome": {
170
+ "description": "denied stands; overridden was denied, and an override counts.",
171
+ "enum": [
172
+ "allowed",
173
+ "denied",
174
+ "overridden"
175
+ ]
176
+ },
177
+ "reasons": {
178
+ "description": "Why it denies the plan, one line each.",
179
+ "$ref": "#/$defs/stringList"
180
+ },
181
+ "override": {
182
+ "type": "object",
183
+ "additionalProperties": false,
184
+ "required": [
185
+ "rule",
186
+ "by",
187
+ "at",
188
+ "reason",
189
+ "digest"
190
+ ],
191
+ "properties": {
192
+ "rule": {
193
+ "type": "string"
194
+ },
195
+ "by": {
196
+ "type": "string"
197
+ },
198
+ "at": {
199
+ "type": "string"
200
+ },
201
+ "reason": {
202
+ "type": "string"
203
+ },
204
+ "digest": {
205
+ "type": "string"
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }