@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,489 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/plan.schema.json",
4
+ "title": "yodel plan <env> --json",
5
+ "description": "Version 1. A project with migrations prints the versioned plan (mode \"versioned\"); a project without prints the declarative plan, chant's diff with the environment and dialect it is of. 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/declarative"
12
+ }
13
+ ],
14
+ "$defs": {
15
+ "declarative": {
16
+ "description": "chant's diff (chant sql plan --json) with environment, dialect and server added. chant owns the diff's fields: ones beyond those listed may appear.",
17
+ "type": "object",
18
+ "required": [
19
+ "environment",
20
+ "dialect",
21
+ "changes",
22
+ "hints"
23
+ ],
24
+ "properties": {
25
+ "environment": {
26
+ "type": "string"
27
+ },
28
+ "dialect": {
29
+ "$ref": "common.schema.json#/$defs/dialect"
30
+ },
31
+ "server": {
32
+ "$ref": "common.schema.json#/$defs/server"
33
+ },
34
+ "changes": {
35
+ "type": "array",
36
+ "items": {
37
+ "$ref": "common.schema.json#/$defs/change"
38
+ }
39
+ },
40
+ "hints": {
41
+ "$ref": "common.schema.json#/$defs/stringList"
42
+ },
43
+ "rebuilds": {
44
+ "description": "ClickHouse: the changes that need a ClickHouseRebuildOp.",
45
+ "type": "array",
46
+ "items": {
47
+ "$ref": "common.schema.json#/$defs/change"
48
+ }
49
+ },
50
+ "rebuildOps": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "object"
54
+ }
55
+ },
56
+ "refused": {
57
+ "description": "Postgres: the changes that need a PostgresMigrationOp.",
58
+ "type": "array",
59
+ "items": {
60
+ "$ref": "common.schema.json#/$defs/change"
61
+ }
62
+ },
63
+ "migrationOps": {
64
+ "type": "array",
65
+ "items": {
66
+ "type": "object"
67
+ }
68
+ },
69
+ "mode": false
70
+ }
71
+ },
72
+ "stepChange": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": [
76
+ "rule",
77
+ "class",
78
+ "field"
79
+ ],
80
+ "properties": {
81
+ "rule": {
82
+ "type": "string"
83
+ },
84
+ "class": {
85
+ "type": "string"
86
+ },
87
+ "field": {
88
+ "type": "string"
89
+ },
90
+ "destructive": {
91
+ "const": true
92
+ }
93
+ }
94
+ },
95
+ "step": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": [
99
+ "index",
100
+ "kind",
101
+ "object",
102
+ "name",
103
+ "done"
104
+ ],
105
+ "properties": {
106
+ "index": {
107
+ "type": "integer",
108
+ "minimum": 0
109
+ },
110
+ "kind": {
111
+ "enum": [
112
+ "statement",
113
+ "op",
114
+ "manual"
115
+ ]
116
+ },
117
+ "object": {
118
+ "type": "string"
119
+ },
120
+ "name": {
121
+ "type": "string"
122
+ },
123
+ "rule": {
124
+ "type": "string"
125
+ },
126
+ "class": {
127
+ "type": "string"
128
+ },
129
+ "destructive": {
130
+ "const": true
131
+ },
132
+ "changes": {
133
+ "type": "array",
134
+ "items": {
135
+ "$ref": "#/$defs/stepChange"
136
+ }
137
+ },
138
+ "sql": {
139
+ "description": "A statement step's SQL, with passwords, secrets and tokens redacted.",
140
+ "type": "string"
141
+ },
142
+ "detail": {
143
+ "type": "string"
144
+ },
145
+ "op": {
146
+ "type": "string"
147
+ },
148
+ "applyRuns": {
149
+ "description": "An Op or manual step: whether yodel apply runs it.",
150
+ "type": "boolean"
151
+ },
152
+ "refused": {
153
+ "description": "Why yodel apply does not run this step.",
154
+ "type": "string"
155
+ },
156
+ "done": {
157
+ "description": "It succeeded in an earlier run and is not sent again.",
158
+ "type": "boolean"
159
+ }
160
+ }
161
+ },
162
+ "moved": {
163
+ "type": "array",
164
+ "items": {
165
+ "type": "object",
166
+ "additionalProperties": false,
167
+ "required": [
168
+ "part",
169
+ "message"
170
+ ],
171
+ "properties": {
172
+ "part": {
173
+ "enum": [
174
+ "environment",
175
+ "history",
176
+ "pending",
177
+ "live"
178
+ ]
179
+ },
180
+ "message": {
181
+ "type": "string"
182
+ }
183
+ }
184
+ }
185
+ },
186
+ "versioned": {
187
+ "type": "object",
188
+ "additionalProperties": false,
189
+ "required": [
190
+ "environment",
191
+ "dialect",
192
+ "mode",
193
+ "applied",
194
+ "pending",
195
+ "problems",
196
+ "notes"
197
+ ],
198
+ "properties": {
199
+ "environment": {
200
+ "type": "string"
201
+ },
202
+ "dialect": {
203
+ "$ref": "common.schema.json#/$defs/dialect"
204
+ },
205
+ "mode": {
206
+ "const": "versioned"
207
+ },
208
+ "server": {
209
+ "$ref": "common.schema.json#/$defs/server"
210
+ },
211
+ "history": {
212
+ "description": "<database>.history, and on ClickHouse the topology and where it came from.",
213
+ "type": "string"
214
+ },
215
+ "applied": {
216
+ "description": "How many migrations the history records applied.",
217
+ "type": "integer",
218
+ "minimum": 0
219
+ },
220
+ "pending": {
221
+ "type": "array",
222
+ "items": {
223
+ "type": "object",
224
+ "additionalProperties": false,
225
+ "required": [
226
+ "id",
227
+ "outOfOrder",
228
+ "steps"
229
+ ],
230
+ "properties": {
231
+ "id": {
232
+ "type": "string"
233
+ },
234
+ "outOfOrder": {
235
+ "type": "boolean"
236
+ },
237
+ "resumeAt": {
238
+ "type": "integer"
239
+ },
240
+ "checks": {
241
+ "type": "array",
242
+ "items": {
243
+ "$ref": "common.schema.json#/$defs/check"
244
+ }
245
+ },
246
+ "steps": {
247
+ "type": "array",
248
+ "items": {
249
+ "$ref": "#/$defs/step"
250
+ }
251
+ }
252
+ }
253
+ }
254
+ },
255
+ "problems": {
256
+ "description": "Directory problems, checksum mismatches, out-of-order migrations.",
257
+ "$ref": "common.schema.json#/$defs/stringList"
258
+ },
259
+ "refusal": {
260
+ "$ref": "common.schema.json#/$defs/refusal"
261
+ },
262
+ "planDigest": {
263
+ "description": "The digest the migrations Op's gate binds; absent when apply would refuse or has nothing to do.",
264
+ "type": "string"
265
+ },
266
+ "policy": {
267
+ "$ref": "common.schema.json#/$defs/policy"
268
+ },
269
+ "op": {
270
+ "description": "The migrations Op.",
271
+ "type": "string"
272
+ },
273
+ "gate": {
274
+ "description": "The Op's gate.",
275
+ "type": "string"
276
+ },
277
+ "approve": {
278
+ "description": "The command a person runs to approve this plan. An agent prints it and never runs it.",
279
+ "type": "string"
280
+ },
281
+ "approval": {
282
+ "description": "The newest approval of the gate in chant's ledger.",
283
+ "type": "object",
284
+ "additionalProperties": false,
285
+ "required": [
286
+ "by",
287
+ "at",
288
+ "holds",
289
+ "sameDigest"
290
+ ],
291
+ "properties": {
292
+ "digest": {
293
+ "type": "string"
294
+ },
295
+ "by": {
296
+ "type": "string"
297
+ },
298
+ "at": {
299
+ "type": "string"
300
+ },
301
+ "holds": {
302
+ "type": "boolean"
303
+ },
304
+ "sameDigest": {
305
+ "type": "boolean"
306
+ },
307
+ "askedAgain": {
308
+ "type": "object",
309
+ "additionalProperties": false,
310
+ "required": [
311
+ "at"
312
+ ],
313
+ "properties": {
314
+ "at": {
315
+ "type": "string"
316
+ },
317
+ "digest": {
318
+ "type": "string"
319
+ }
320
+ }
321
+ },
322
+ "moved": {
323
+ "type": "object",
324
+ "additionalProperties": false,
325
+ "required": [
326
+ "confirmed",
327
+ "changes"
328
+ ],
329
+ "properties": {
330
+ "confirmed": {
331
+ "type": "boolean"
332
+ },
333
+ "changes": {
334
+ "$ref": "#/$defs/moved"
335
+ }
336
+ }
337
+ }
338
+ }
339
+ },
340
+ "opMissing": {
341
+ "description": "The project declares no migrations Op for the environment: the first line of how to declare one.",
342
+ "type": "string"
343
+ },
344
+ "wave": {
345
+ "description": "The environment's wave of the apply pipeline, when yodel.config.ts declares waves and names it.",
346
+ "type": "object",
347
+ "additionalProperties": false,
348
+ "required": [
349
+ "wave",
350
+ "gate",
351
+ "base",
352
+ "baseSource",
353
+ "destructiveSteps",
354
+ "waits",
355
+ "planDigest",
356
+ "digest",
357
+ "approve",
358
+ "promotions",
359
+ "blocked"
360
+ ],
361
+ "properties": {
362
+ "wave": {
363
+ "description": "1-based, in yodel.config.ts waves.",
364
+ "type": "integer",
365
+ "minimum": 1
366
+ },
367
+ "gate": {
368
+ "description": "The gate policy at the base commit.",
369
+ "enum": [
370
+ "always",
371
+ "on-destructive",
372
+ "never"
373
+ ]
374
+ },
375
+ "base": {
376
+ "type": "string"
377
+ },
378
+ "baseSource": {
379
+ "type": "string"
380
+ },
381
+ "destructiveSteps": {
382
+ "type": "array",
383
+ "items": {
384
+ "$ref": "apply.schema.json#/$defs/destructiveStep"
385
+ }
386
+ },
387
+ "waits": {
388
+ "description": "Under that gate, the wave waits for an approval of this plan.",
389
+ "type": "boolean"
390
+ },
391
+ "planDigest": {
392
+ "description": "The wave plan digest.",
393
+ "type": "string"
394
+ },
395
+ "digest": {
396
+ "description": "The set digest the wave's gate binds.",
397
+ "type": "string"
398
+ },
399
+ "approve": {
400
+ "description": "The chant approve command for the wave, for a person to run.",
401
+ "type": "string"
402
+ },
403
+ "promotions": {
404
+ "description": "Each environment this one requires (waves[].requires) and what its history records of each pending migration.",
405
+ "type": "array",
406
+ "items": {
407
+ "type": "object",
408
+ "additionalProperties": false,
409
+ "required": [
410
+ "env",
411
+ "from",
412
+ "migrations"
413
+ ],
414
+ "properties": {
415
+ "env": {
416
+ "type": "string"
417
+ },
418
+ "from": {
419
+ "description": "Where the requirement is declared: yodel.config.ts, at the base commit, or both.",
420
+ "type": "string"
421
+ },
422
+ "migrations": {
423
+ "type": "array",
424
+ "items": {
425
+ "type": "object",
426
+ "additionalProperties": false,
427
+ "required": [
428
+ "id",
429
+ "checksum",
430
+ "ran"
431
+ ],
432
+ "properties": {
433
+ "id": {
434
+ "type": "string"
435
+ },
436
+ "checksum": {
437
+ "type": "string"
438
+ },
439
+ "ran": {
440
+ "enum": [
441
+ "applied",
442
+ "not applied",
443
+ "applied with another checksum"
444
+ ]
445
+ },
446
+ "recorded": {
447
+ "description": "The checksum the required environment recorded, when it differs.",
448
+ "type": "string"
449
+ }
450
+ }
451
+ }
452
+ }
453
+ }
454
+ }
455
+ },
456
+ "blocked": {
457
+ "description": "A pending migration has not run where it must first: the wave refuses it until it has.",
458
+ "type": "boolean"
459
+ }
460
+ }
461
+ },
462
+ "sinceLast": {
463
+ "description": "The pull request comment this plan replaces showed another digest: what moved since.",
464
+ "type": "object",
465
+ "additionalProperties": false,
466
+ "required": [
467
+ "digest",
468
+ "confirmed",
469
+ "changes"
470
+ ],
471
+ "properties": {
472
+ "digest": {
473
+ "type": "string"
474
+ },
475
+ "confirmed": {
476
+ "type": "boolean"
477
+ },
478
+ "changes": {
479
+ "$ref": "#/$defs/moved"
480
+ }
481
+ }
482
+ },
483
+ "notes": {
484
+ "$ref": "common.schema.json#/$defs/stringList"
485
+ }
486
+ }
487
+ }
488
+ }
489
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/rebase.schema.json",
4
+ "title": "yodel rebase --json",
5
+ "description": "Version 1. The migration moved onto its new parent and every migration rewritten, or rebased false when there was nothing to move. Within a version, fields are only added; a reader ignores fields it does not know.",
6
+ "oneOf": [
7
+ {
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "required": ["rebased"],
11
+ "properties": { "rebased": { "const": false } }
12
+ },
13
+ {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": ["rebased", "moved", "from", "onto", "historiesChecked", "rewritten"],
17
+ "properties": {
18
+ "rebased": { "const": true },
19
+ "moved": { "type": "string" },
20
+ "from": { "type": ["string", "null"] },
21
+ "onto": { "type": "string" },
22
+ "historiesChecked": { "description": "The environments (--env) whose histories were checked so a migration that ran is never moved.", "$ref": "common.schema.json#/$defs/stringList" },
23
+ "rewritten": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": ["id", "path", "oldParent", "parent", "oldChecksum", "checksum", "statements", "refused", "silences", "handEdited"],
29
+ "properties": {
30
+ "id": { "type": "string" },
31
+ "path": { "type": "string" },
32
+ "oldParent": { "type": ["string", "null"] },
33
+ "parent": { "type": ["string", "null"] },
34
+ "oldChecksum": { "type": "string" },
35
+ "checksum": { "type": "string" },
36
+ "statements": { "type": "integer", "minimum": 0 },
37
+ "refused": { "type": "boolean" },
38
+ "silences": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": ["step", "rule", "reason", "line"],
44
+ "properties": { "step": { "type": "integer" }, "rule": { "type": "string" }, "reason": { "type": "string" }, "line": { "type": "integer" } }
45
+ }
46
+ },
47
+ "handEdited": { "type": "boolean" }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ ]
54
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/repair.schema.json",
4
+ "title": "yodel repair <env> <id> --reason <text> --json",
5
+ "description": "Version 1. The checksum recorded for an applied migration, with the reason, and whether migration.json's own checksum field was written again. Within a version, fields are only added; a reader ignores fields it does not know.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["repaired", "id", "environment", "oldChecksum", "newChecksum", "reason", "seq", "runId", "migrationJsonUpdated"],
9
+ "properties": {
10
+ "repaired": { "const": true },
11
+ "id": { "type": "string" },
12
+ "environment": { "type": "string" },
13
+ "oldChecksum": { "type": "string" },
14
+ "newChecksum": { "type": "string" },
15
+ "reason": { "type": "string" },
16
+ "seq": { "type": "integer" },
17
+ "runId": { "type": "string" },
18
+ "migrationJsonUpdated": { "type": "boolean" }
19
+ }
20
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/report.schema.json",
4
+ "title": "yodel report [<env>...] --json",
5
+ "description": "Version 1. Every environment's migrations side by side, the audit log derived from each environment's history table and chant's gate ledger, and the gaps those sources show. Within a version, fields are only added; a reader ignores fields it does not know.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["version", "generatedAt", "project", "dialect", "migrations", "environments", "audit", "gaps"],
9
+ "properties": {
10
+ "version": { "const": 1 },
11
+ "generatedAt": { "type": "string", "description": "When the report was read, ISO 8601 UTC." },
12
+ "project": { "type": "string", "description": "The project directory." },
13
+ "dialect": { "enum": ["clickhouse", "postgres"] },
14
+ "migrations": { "type": "array", "items": { "type": "string" }, "description": "The migrations in chain order, then any an environment applied that the directory no longer has." },
15
+ "environments": { "type": "array", "items": { "$ref": "#/$defs/environment" } },
16
+ "audit": { "type": "array", "items": { "$ref": "#/$defs/entry" }, "description": "Every environment's audit entries, oldest first." },
17
+ "gaps": { "type": "array", "items": { "$ref": "#/$defs/gap" } },
18
+ "auditFile": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": ["path", "appended", "missing"],
22
+ "description": "With --audit: the file, how many entries were appended (0 with --check), and the entries of the file the sources no longer give.",
23
+ "properties": {
24
+ "path": { "type": "string" },
25
+ "appended": { "type": "integer", "minimum": 0 },
26
+ "missing": { "type": "array", "items": { "$ref": "#/$defs/entry" } }
27
+ }
28
+ }
29
+ },
30
+ "$defs": {
31
+ "environment": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["name", "notes", "migrations"],
35
+ "properties": {
36
+ "name": { "type": "string" },
37
+ "history": { "type": "string", "description": "<database>.history" },
38
+ "op": {
39
+ "type": "object",
40
+ "additionalProperties": false,
41
+ "required": ["name", "gate"],
42
+ "properties": { "name": { "type": "string" }, "gate": { "type": "string" } }
43
+ },
44
+ "error": { "type": "string", "description": "Why the environment could not be read." },
45
+ "notes": { "type": "array", "items": { "type": "string" } },
46
+ "migrations": { "type": "array", "items": { "$ref": "#/$defs/migration" } }
47
+ }
48
+ },
49
+ "migration": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["id", "state", "inDirectory"],
53
+ "properties": {
54
+ "id": { "type": "string" },
55
+ "state": { "enum": ["applied", "pending", "failed", "started", "reverted"] },
56
+ "inDirectory": { "type": "boolean" },
57
+ "at": { "type": "string" },
58
+ "by": { "type": "string" },
59
+ "digest": { "type": "string" },
60
+ "approvedBy": { "type": "string" },
61
+ "approvedAt": { "type": "string" }
62
+ }
63
+ },
64
+ "entry": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "required": ["id", "at", "environment", "kind", "source"],
68
+ "description": "One audit entry; audit.jsonl holds one per line.",
69
+ "properties": {
70
+ "id": { "type": "string", "description": "A hash of the entry and its source: the same sources give the same id." },
71
+ "at": { "type": "string" },
72
+ "environment": { "type": "string" },
73
+ "kind": { "enum": ["approval-requested", "approved", "override", "silenced", "applied", "refused", "failed", "repaired", "reverted"] },
74
+ "by": { "type": "string" },
75
+ "migration": { "type": "string" },
76
+ "digest": { "type": "string" },
77
+ "detail": { "type": "string" },
78
+ "wave": {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": ["gate", "digest", "status"],
82
+ "description": "On an applied entry a wave of the apply pipeline applied: the wave's gate, its set digest, and whether the wave was approved or its policy at the base needed no approval.",
83
+ "properties": { "gate": { "type": "string" }, "digest": { "type": "string" }, "status": { "enum": ["approved", "not-required"] } }
84
+ },
85
+ "source": {
86
+ "oneOf": [
87
+ {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["ledger", "op", "gate"],
91
+ "properties": { "ledger": { "type": "string" }, "op": { "type": "string" }, "gate": { "type": "string" } }
92
+ },
93
+ {
94
+ "type": "object",
95
+ "additionalProperties": false,
96
+ "required": ["history", "seq", "run"],
97
+ "properties": { "history": { "type": "string" }, "seq": { "type": "integer", "minimum": 1 }, "run": { "type": "string" } }
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ },
103
+ "gap": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "required": ["environment", "kind", "detail"],
107
+ "properties": {
108
+ "environment": { "type": "string" },
109
+ "kind": { "enum": ["history-row", "approval"] },
110
+ "detail": { "type": "string" }
111
+ }
112
+ }
113
+ }
114
+ }