@treeseed/sdk 0.11.0 → 0.12.4

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 (473) hide show
  1. package/README.md +9 -4
  2. package/dist/agent-capacity.d.ts +916 -0
  3. package/dist/agent-capacity.js +1600 -0
  4. package/dist/agent-tools.d.ts +37 -0
  5. package/dist/agent-tools.js +301 -0
  6. package/dist/api/app.d.ts +1 -1
  7. package/dist/api/auth/d1-database.d.ts +2 -2
  8. package/dist/api/auth/d1-provider.d.ts +4 -4
  9. package/dist/api/auth/d1-store.d.ts +2 -2
  10. package/dist/api/auth/memory-provider.d.ts +1 -1
  11. package/dist/api/auth/tokens.d.ts +1 -1
  12. package/dist/api/config.d.ts +3 -1
  13. package/dist/api/config.js +34 -10
  14. package/dist/api/http.d.ts +2 -2
  15. package/dist/api/index.d.ts +10 -10
  16. package/dist/api/index.js +4 -2
  17. package/dist/api/operations-routes.d.ts +3 -3
  18. package/dist/api/operations.d.ts +1 -1
  19. package/dist/api/providers.d.ts +1 -1
  20. package/dist/api/providers.js +21 -4
  21. package/dist/api/railway.d.ts +3 -2
  22. package/dist/api/sdk-dispatch.d.ts +4 -4
  23. package/dist/api/sdk-routes.d.ts +2 -2
  24. package/dist/api/templates.d.ts +2 -2
  25. package/dist/api/types.d.ts +3 -2
  26. package/dist/capacity-provider.d.ts +117 -60
  27. package/dist/capacity-provider.js +215 -43
  28. package/dist/capacity.d.ts +2 -2
  29. package/dist/cli-tools.d.ts +1 -1
  30. package/dist/content-operations.d.ts +97 -0
  31. package/dist/content-operations.js +250 -0
  32. package/dist/content-store.d.ts +4 -4
  33. package/dist/control-plane-client.d.ts +13 -18
  34. package/dist/control-plane-client.js +8 -86
  35. package/dist/control-plane.d.ts +2 -2
  36. package/dist/copilot.d.ts +3 -0
  37. package/dist/copilot.js +16 -1
  38. package/dist/d1-http.d.ts +1 -1
  39. package/dist/d1-store.d.ts +32 -57
  40. package/dist/d1-store.js +115 -318
  41. package/dist/db/d1.d.ts +1 -232
  42. package/dist/db/index.d.ts +3 -3
  43. package/dist/db/market-schema.d.ts +49037 -11843
  44. package/dist/db/market-schema.js +1788 -50
  45. package/dist/db/node-sqlite.d.ts +1 -232
  46. package/dist/db/schema.d.ts +0 -462
  47. package/dist/db/schema.js +2 -22
  48. package/dist/dispatch.d.ts +1 -1
  49. package/dist/dispatch.js +0 -11
  50. package/dist/fixture-support.js +52 -4
  51. package/dist/governance.d.ts +133 -0
  52. package/dist/governance.js +285 -0
  53. package/dist/graph/build.d.ts +2 -2
  54. package/dist/graph/context-query-contracts.d.ts +1 -1
  55. package/dist/graph/dsl.d.ts +1 -1
  56. package/dist/graph/query.d.ts +4 -4
  57. package/dist/graph/ranking.d.ts +1 -1
  58. package/dist/graph/schema.d.ts +1 -1
  59. package/dist/graph.d.ts +11 -11
  60. package/dist/guarantees/index.d.ts +425 -0
  61. package/dist/guarantees/index.js +1146 -0
  62. package/dist/hosting/apps.d.ts +1 -1
  63. package/dist/hosting/builtins.d.ts +1 -1
  64. package/dist/hosting/builtins.js +9 -198
  65. package/dist/hosting/contracts.d.ts +3 -2
  66. package/dist/hosting/graph.d.ts +24 -21
  67. package/dist/hosting/graph.js +280 -294
  68. package/dist/hosting/index.d.ts +4 -4
  69. package/dist/index.d.ts +88 -74
  70. package/dist/index.js +81 -10
  71. package/dist/local-dev/managed-dev.d.ts +85 -0
  72. package/dist/local-dev/managed-dev.js +368 -0
  73. package/dist/managed-dependencies.d.ts +9 -0
  74. package/dist/managed-dependencies.js +10 -8
  75. package/dist/market-client.d.ts +265 -7
  76. package/dist/market-client.js +381 -9
  77. package/dist/model-registry.d.ts +1 -1
  78. package/dist/model-registry.js +19 -19
  79. package/dist/operations/agent-tools.d.ts +2 -11
  80. package/dist/operations/agent-tools.js +2 -14
  81. package/dist/operations/providers/default.d.ts +1 -1
  82. package/dist/operations/providers/default.js +20 -37
  83. package/dist/operations/repository-operations.d.ts +26 -2
  84. package/dist/operations/repository-operations.js +159 -1
  85. package/dist/operations/runtime.d.ts +3 -3
  86. package/dist/operations/services/bootstrap-runner.d.ts +1 -1
  87. package/dist/operations/services/build-warning-policy.d.ts +34 -0
  88. package/dist/operations/services/build-warning-policy.js +81 -82
  89. package/dist/operations/services/commit-message-provider.js +4 -4
  90. package/dist/operations/services/config-runtime.d.ts +73 -19
  91. package/dist/operations/services/config-runtime.js +276 -100
  92. package/dist/operations/services/deploy.d.ts +41 -622
  93. package/dist/operations/services/deploy.js +181 -213
  94. package/dist/operations/services/deployment-readiness.d.ts +1 -1
  95. package/dist/operations/services/deployment-readiness.js +38 -7
  96. package/dist/operations/services/git-remote-policy.js +12 -4
  97. package/dist/operations/services/git-runner.d.ts +66 -0
  98. package/dist/operations/services/git-runner.js +479 -0
  99. package/dist/operations/services/git-workflow.d.ts +43 -5
  100. package/dist/operations/services/git-workflow.js +242 -20
  101. package/dist/operations/services/github-actions-verification.d.ts +3 -1
  102. package/dist/operations/services/github-actions-verification.js +11 -3
  103. package/dist/operations/services/github-api.js +21 -5
  104. package/dist/operations/services/github-automation.d.ts +3 -3
  105. package/dist/operations/services/github-automation.js +15 -18
  106. package/dist/operations/services/github-credentials.js +2 -1
  107. package/dist/operations/services/hosted-service-checks.d.ts +19 -1
  108. package/dist/operations/services/hosted-service-checks.js +162 -11
  109. package/dist/operations/services/hosting-audit.d.ts +2 -2
  110. package/dist/operations/services/hosting-audit.js +7 -7
  111. package/dist/operations/services/hub-launch.d.ts +1 -1
  112. package/dist/operations/services/hub-provider-launch.d.ts +5 -5
  113. package/dist/operations/services/hub-provider-launch.js +19 -14
  114. package/dist/operations/services/live-hosted-service-checks.d.ts +2 -1
  115. package/dist/operations/services/live-hosted-service-checks.js +193 -80
  116. package/dist/operations/services/local-dev.js +0 -1
  117. package/dist/operations/services/managed-host-security.d.ts +1 -1
  118. package/dist/operations/services/managed-repositories.d.ts +37 -0
  119. package/dist/operations/services/managed-repositories.js +177 -0
  120. package/dist/operations/services/operations-runner-smoke.d.ts +3 -2
  121. package/dist/operations/services/operations-runner-smoke.js +22 -4
  122. package/dist/operations/services/package-adapters.d.ts +77 -2
  123. package/dist/operations/services/package-adapters.js +627 -56
  124. package/dist/operations/services/package-reference-policy.d.ts +12 -88
  125. package/dist/operations/services/package-reference-policy.js +81 -213
  126. package/dist/operations/services/project-host-operations.d.ts +4 -4
  127. package/dist/operations/services/project-platform.d.ts +19 -193
  128. package/dist/operations/services/project-platform.js +31 -103
  129. package/dist/operations/services/project-web-monitor.d.ts +2 -2
  130. package/dist/operations/services/project-web-monitor.js +97 -2
  131. package/dist/operations/services/railway-api.d.ts +36 -7
  132. package/dist/operations/services/railway-api.js +331 -100
  133. package/dist/operations/services/railway-deploy.d.ts +7 -95
  134. package/dist/operations/services/railway-deploy.js +334 -742
  135. package/dist/operations/services/release-history.js +3 -4
  136. package/dist/operations/services/release-proof-ledger.d.ts +13 -0
  137. package/dist/operations/services/release-proof-ledger.js +81 -0
  138. package/dist/operations/services/release-proof-planner.d.ts +48 -0
  139. package/dist/operations/services/release-proof-planner.js +195 -0
  140. package/dist/operations/services/release-proof-runner.d.ts +16 -0
  141. package/dist/operations/services/release-proof-runner.js +169 -0
  142. package/dist/operations/services/release-proof.d.ts +81 -0
  143. package/dist/operations/services/release-proof.js +79 -0
  144. package/dist/operations/services/repository-save-orchestrator.d.ts +6 -7
  145. package/dist/operations/services/repository-save-orchestrator.js +353 -174
  146. package/dist/operations/services/runtime-paths.d.ts +1 -3
  147. package/dist/operations/services/runtime-paths.js +0 -4
  148. package/dist/operations/services/runtime-tools.d.ts +1 -192
  149. package/dist/operations/services/runtime-tools.js +4 -444
  150. package/dist/operations/services/save-deploy-preflight.js +9 -1
  151. package/dist/operations/services/template-host-bindings.d.ts +2 -2
  152. package/dist/operations/services/template-host-bindings.js +3 -2
  153. package/dist/operations/services/template-registry.d.ts +6 -6
  154. package/dist/operations/services/template-registry.js +33 -14
  155. package/dist/operations/services/template-secret-sync.d.ts +3 -3
  156. package/dist/operations/services/workflow-timing.d.ts +25 -0
  157. package/dist/operations/services/workflow-timing.js +79 -0
  158. package/dist/operations/services/workspace-dependency-mode.js +41 -4
  159. package/dist/operations/services/workspace-preflight.js +8 -8
  160. package/dist/operations/services/workspace-save-script.d.ts +4 -4
  161. package/dist/operations/services/workspace-save.d.ts +1 -0
  162. package/dist/operations/services/workspace-save.js +41 -18
  163. package/dist/operations/services/workspace-tools.js +40 -6
  164. package/dist/operations-registry.d.ts +1 -1
  165. package/dist/operations-registry.js +5 -6
  166. package/dist/operations-types.d.ts +1 -1
  167. package/dist/operations.d.ts +17 -11
  168. package/dist/operations.js +57 -3
  169. package/dist/platform/book-export.js +2 -0
  170. package/dist/platform/books-data.d.ts +1 -1
  171. package/dist/platform/config.d.ts +27 -0
  172. package/dist/platform/config.js +100 -0
  173. package/dist/platform/content-runtime-source.d.ts +54 -0
  174. package/dist/platform/content-runtime-source.js +169 -0
  175. package/dist/platform/contracts.d.ts +6 -1
  176. package/dist/platform/deploy-config.d.ts +1 -1
  177. package/dist/platform/deploy-config.js +7 -1
  178. package/dist/platform/deploy-runtime.d.ts +1 -1
  179. package/dist/platform/desired-state.d.ts +63 -0
  180. package/dist/platform/desired-state.js +1021 -0
  181. package/dist/platform/env.yaml +414 -19
  182. package/dist/platform/environment.d.ts +2 -2
  183. package/dist/platform/environment.js +54 -22
  184. package/dist/platform/local-content-materialization.d.ts +9 -0
  185. package/dist/platform/local-content-materialization.js +212 -0
  186. package/dist/platform/plugin.d.ts +5 -5
  187. package/dist/platform/plugins/runtime.d.ts +3 -3
  188. package/dist/platform/plugins/runtime.js +62 -1
  189. package/dist/platform/plugins.d.ts +6 -6
  190. package/dist/platform/published-content-pipeline.d.ts +3 -3
  191. package/dist/platform/published-content-pipeline.js +5 -1
  192. package/dist/platform/published-content.d.ts +4 -3
  193. package/dist/platform/site-config-schema.d.ts +1 -0
  194. package/dist/platform/site-config-schema.js +4 -1
  195. package/dist/platform/tenant/runtime-config.d.ts +152 -2
  196. package/dist/platform/tenant-config.d.ts +1 -1
  197. package/dist/platform/utils/site-config-schema.d.ts +154 -0
  198. package/dist/platform/utils/site-config-schema.js +400 -461
  199. package/dist/platform-operation-store.d.ts +1 -1
  200. package/dist/plugin-default.d.ts +1 -1
  201. package/dist/plugin-default.js +27 -12
  202. package/dist/project-import.d.ts +91 -0
  203. package/dist/project-import.js +257 -0
  204. package/dist/project-workflow.d.ts +1 -1
  205. package/dist/reconcile/bootstrap-systems.d.ts +2 -2
  206. package/dist/reconcile/bootstrap-systems.js +3 -3
  207. package/dist/reconcile/builtin-adapters.d.ts +7 -1
  208. package/dist/reconcile/builtin-adapters.js +2924 -346
  209. package/dist/reconcile/contracts.d.ts +15 -2
  210. package/dist/reconcile/desired-state.d.ts +2 -193
  211. package/dist/reconcile/desired-state.js +24 -33
  212. package/dist/reconcile/engine.d.ts +60 -397
  213. package/dist/reconcile/engine.js +182 -18
  214. package/dist/reconcile/index.d.ts +10 -10
  215. package/dist/reconcile/live-acceptance.d.ts +22 -1
  216. package/dist/reconcile/live-acceptance.js +456 -44
  217. package/dist/reconcile/providers/docker-private.d.ts +54 -0
  218. package/dist/reconcile/providers/docker-private.js +101 -0
  219. package/dist/reconcile/providers/github-private.d.ts +65 -0
  220. package/dist/reconcile/providers/github-private.js +119 -0
  221. package/dist/reconcile/providers/local-private.d.ts +28 -0
  222. package/dist/reconcile/providers/local-private.js +75 -0
  223. package/dist/reconcile/providers/railway-iac.d.ts +66 -0
  224. package/dist/reconcile/providers/railway-iac.js +275 -0
  225. package/dist/reconcile/providers/release-private.d.ts +92 -0
  226. package/dist/reconcile/providers/release-private.js +152 -0
  227. package/dist/reconcile/registry.d.ts +2 -2
  228. package/dist/reconcile/registry.js +16 -1
  229. package/dist/reconcile/state.d.ts +1 -1
  230. package/dist/reconcile/state.js +3 -40
  231. package/dist/reconcile/units.d.ts +1 -1
  232. package/dist/reconcile/units.js +7 -1
  233. package/dist/remote.d.ts +6 -6
  234. package/dist/scenes/artifacts.d.ts +16 -0
  235. package/dist/scenes/artifacts.js +61 -0
  236. package/dist/scenes/auth.d.ts +2 -0
  237. package/dist/scenes/auth.js +28 -0
  238. package/dist/scenes/base-url.d.ts +12 -0
  239. package/dist/scenes/base-url.js +123 -0
  240. package/dist/scenes/builtin-plugins.d.ts +2 -0
  241. package/dist/scenes/builtin-plugins.js +447 -0
  242. package/dist/scenes/checkpoints.d.ts +14 -0
  243. package/dist/scenes/checkpoints.js +33 -0
  244. package/dist/scenes/device-matrix.d.ts +2 -0
  245. package/dist/scenes/device-matrix.js +97 -0
  246. package/dist/scenes/devices.d.ts +11 -0
  247. package/dist/scenes/devices.js +22 -0
  248. package/dist/scenes/diagnostics.d.ts +5 -0
  249. package/dist/scenes/diagnostics.js +22 -0
  250. package/dist/scenes/diagram-providers.d.ts +2 -0
  251. package/dist/scenes/diagram-providers.js +181 -0
  252. package/dist/scenes/diagram-validation.d.ts +22 -0
  253. package/dist/scenes/diagram-validation.js +74 -0
  254. package/dist/scenes/environment.d.ts +2 -0
  255. package/dist/scenes/environment.js +65 -0
  256. package/dist/scenes/evidence-bundle.d.ts +5 -0
  257. package/dist/scenes/evidence-bundle.js +42 -0
  258. package/dist/scenes/evidence-report.d.ts +10 -0
  259. package/dist/scenes/evidence-report.js +73 -0
  260. package/dist/scenes/evidence.d.ts +16 -0
  261. package/dist/scenes/evidence.js +277 -0
  262. package/dist/scenes/index.d.ts +48 -0
  263. package/dist/scenes/index.js +312 -0
  264. package/dist/scenes/inspect.d.ts +9 -0
  265. package/dist/scenes/inspect.js +64 -0
  266. package/dist/scenes/loader.d.ts +3 -0
  267. package/dist/scenes/loader.js +38 -0
  268. package/dist/scenes/logs.d.ts +2 -0
  269. package/dist/scenes/logs.js +47 -0
  270. package/dist/scenes/operations.d.ts +3 -0
  271. package/dist/scenes/operations.js +128 -0
  272. package/dist/scenes/phase0.d.ts +9 -0
  273. package/dist/scenes/phase0.js +637 -0
  274. package/dist/scenes/planner.d.ts +12 -0
  275. package/dist/scenes/planner.js +166 -0
  276. package/dist/scenes/playwright-adapter.d.ts +2 -0
  277. package/dist/scenes/playwright-adapter.js +63 -0
  278. package/dist/scenes/plugins.d.ts +5 -0
  279. package/dist/scenes/plugins.js +115 -0
  280. package/dist/scenes/progress.d.ts +17 -0
  281. package/dist/scenes/progress.js +24 -0
  282. package/dist/scenes/publish-destinations.d.ts +12 -0
  283. package/dist/scenes/publish-destinations.js +99 -0
  284. package/dist/scenes/publish-plan-report.d.ts +10 -0
  285. package/dist/scenes/publish-plan-report.js +70 -0
  286. package/dist/scenes/publish-plan.d.ts +15 -0
  287. package/dist/scenes/publish-plan.js +248 -0
  288. package/dist/scenes/publish-redaction.d.ts +16 -0
  289. package/dist/scenes/publish-redaction.js +148 -0
  290. package/dist/scenes/publish-release-record.d.ts +13 -0
  291. package/dist/scenes/publish-release-record.js +34 -0
  292. package/dist/scenes/publish-report.d.ts +10 -0
  293. package/dist/scenes/publish-report.js +67 -0
  294. package/dist/scenes/publish.d.ts +16 -0
  295. package/dist/scenes/publish.js +298 -0
  296. package/dist/scenes/registry.d.ts +12 -0
  297. package/dist/scenes/registry.js +65 -0
  298. package/dist/scenes/remotion-adapter.d.ts +3 -0
  299. package/dist/scenes/remotion-adapter.js +94 -0
  300. package/dist/scenes/remotion-composition-registry.d.ts +2 -0
  301. package/dist/scenes/remotion-composition-registry.js +12 -0
  302. package/dist/scenes/remotion-compositions.d.ts +15 -0
  303. package/dist/scenes/remotion-compositions.js +464 -0
  304. package/dist/scenes/remotion-diagrams.d.ts +9 -0
  305. package/dist/scenes/remotion-diagrams.js +188 -0
  306. package/dist/scenes/remotion-input.d.ts +13 -0
  307. package/dist/scenes/remotion-input.js +291 -0
  308. package/dist/scenes/remotion-visuals.d.ts +29 -0
  309. package/dist/scenes/remotion-visuals.js +198 -0
  310. package/dist/scenes/render-media-assets.d.ts +9 -0
  311. package/dist/scenes/render-media-assets.js +117 -0
  312. package/dist/scenes/render-report.d.ts +10 -0
  313. package/dist/scenes/render-report.js +27 -0
  314. package/dist/scenes/render.d.ts +2 -0
  315. package/dist/scenes/render.js +218 -0
  316. package/dist/scenes/reporter.d.ts +3 -0
  317. package/dist/scenes/reporter.js +101 -0
  318. package/dist/scenes/resume.d.ts +2 -0
  319. package/dist/scenes/resume.js +79 -0
  320. package/dist/scenes/runner.d.ts +2 -0
  321. package/dist/scenes/runner.js +674 -0
  322. package/dist/scenes/schema.d.ts +6 -0
  323. package/dist/scenes/schema.js +994 -0
  324. package/dist/scenes/seed.d.ts +2 -0
  325. package/dist/scenes/seed.js +83 -0
  326. package/dist/scenes/segments.d.ts +15 -0
  327. package/dist/scenes/segments.js +79 -0
  328. package/dist/scenes/selectors.d.ts +3 -0
  329. package/dist/scenes/selectors.js +21 -0
  330. package/dist/scenes/timeline.d.ts +11 -0
  331. package/dist/scenes/timeline.js +26 -0
  332. package/dist/scenes/timeouts.d.ts +6 -0
  333. package/dist/scenes/timeouts.js +17 -0
  334. package/dist/scenes/training-captions.d.ts +14 -0
  335. package/dist/scenes/training-captions.js +98 -0
  336. package/dist/scenes/training-report.d.ts +10 -0
  337. package/dist/scenes/training-report.js +78 -0
  338. package/dist/scenes/training-transcript.d.ts +24 -0
  339. package/dist/scenes/training-transcript.js +204 -0
  340. package/dist/scenes/training.d.ts +10 -0
  341. package/dist/scenes/training.js +134 -0
  342. package/dist/scenes/types.d.ts +1872 -0
  343. package/dist/scenes/types.js +8 -0
  344. package/dist/scenes/visual-audit-contact-sheets.d.ts +6 -0
  345. package/dist/scenes/visual-audit-contact-sheets.js +119 -0
  346. package/dist/scenes/visual-audit-fixtures.d.ts +25 -0
  347. package/dist/scenes/visual-audit-fixtures.js +210 -0
  348. package/dist/scenes/visual-audit-report.d.ts +11 -0
  349. package/dist/scenes/visual-audit-report.js +85 -0
  350. package/dist/scenes/visual-audit-review.d.ts +23 -0
  351. package/dist/scenes/visual-audit-review.js +829 -0
  352. package/dist/scenes/visual-audit-routes.d.ts +13 -0
  353. package/dist/scenes/visual-audit-routes.js +308 -0
  354. package/dist/scenes/visual-audit.d.ts +3 -0
  355. package/dist/scenes/visual-audit.js +596 -0
  356. package/dist/scripts/build-dist.js +154 -40
  357. package/dist/scripts/check-build-warnings.js +42 -53
  358. package/dist/scripts/cleanup-markdown.js +1 -1
  359. package/dist/scripts/cli-test-fixtures.js +24 -28
  360. package/dist/scripts/migrate-journey-csv-to-guarantees.js +140 -0
  361. package/dist/scripts/package-tools.js +12 -1
  362. package/dist/scripts/prepare.js +3 -7
  363. package/dist/scripts/release-verify.js +2 -5
  364. package/dist/scripts/run-fixture-astro-command.js +1 -1
  365. package/dist/scripts/template-catalog.test.js +68 -82
  366. package/dist/scripts/tenant-dev.js +0 -10
  367. package/dist/scripts/test-cloudflare-local.js +1 -1
  368. package/dist/scripts/test-scaffold.js +0 -1
  369. package/dist/scripts/test-smoke.js +3 -3
  370. package/dist/scripts/treeseed-build-dist.js +4 -7
  371. package/dist/scripts/treeseed-release-verify.js +1 -1
  372. package/dist/scripts/verify-driver.js +30 -21
  373. package/dist/scripts/workflow-commands.test.js +18 -27
  374. package/dist/scripts/workspace-command-e2e.js +1 -1
  375. package/dist/scripts/workspace-lint.js +6 -0
  376. package/dist/scripts/workspace-release-test.js +90 -1
  377. package/dist/scripts/workspace-test.js +6 -0
  378. package/dist/sdk-dispatch.d.ts +1 -1
  379. package/dist/sdk-dispatch.js +0 -16
  380. package/dist/sdk-fields.d.ts +1 -1
  381. package/dist/sdk-filters.d.ts +1 -1
  382. package/dist/sdk-types.d.ts +1184 -113
  383. package/dist/sdk-types.js +393 -0
  384. package/dist/sdk.d.ts +74 -79
  385. package/dist/sdk.js +27 -36
  386. package/dist/secrets-capability.d.ts +421 -0
  387. package/dist/secrets-capability.js +530 -0
  388. package/dist/seeds/normalize.js +1 -0
  389. package/dist/seeds/planner.js +38 -0
  390. package/dist/seeds/schema.js +293 -4
  391. package/dist/seeds/types.d.ts +60 -0
  392. package/dist/seeds/types.js +9 -1
  393. package/dist/service-credentials.d.ts +54 -0
  394. package/dist/service-credentials.js +112 -0
  395. package/dist/stores/cursor-store.d.ts +2 -2
  396. package/dist/stores/envelopes.d.ts +1 -1
  397. package/dist/stores/helpers.d.ts +1 -1
  398. package/dist/stores/lease-store.d.ts +2 -2
  399. package/dist/stores/message-store.d.ts +2 -2
  400. package/dist/stores/operational-store.d.ts +3 -26
  401. package/dist/stores/operational-store.js +0 -225
  402. package/dist/stores/project-workflow-store.d.ts +2 -2
  403. package/dist/stores/run-store.d.ts +2 -3
  404. package/dist/stores/run-store.js +0 -98
  405. package/dist/stores/subscription-store.d.ts +2 -3
  406. package/dist/stores/subscription-store.js +0 -100
  407. package/dist/template-catalog.d.ts +1 -1
  408. package/dist/template-launch-requirements.d.ts +2 -2
  409. package/dist/template-launch-ui.d.ts +2 -2
  410. package/dist/treedx/adapters.d.ts +6 -6
  411. package/dist/treedx/client.d.ts +1 -1
  412. package/dist/treedx/errors.d.ts +1 -1
  413. package/dist/treedx/federated-client.d.ts +3 -3
  414. package/dist/treedx/graph-adapter.d.ts +2 -2
  415. package/dist/treedx/index.d.ts +14 -14
  416. package/dist/treedx/market-integration.d.ts +1 -1
  417. package/dist/treedx/ports.d.ts +30 -30
  418. package/dist/treedx/query-adapter.d.ts +3 -3
  419. package/dist/treedx/registry-client.d.ts +2 -2
  420. package/dist/treedx/repository-adapter.d.ts +4 -4
  421. package/dist/treedx/repository-adapter.js +14 -3
  422. package/dist/treedx/sdk-integration.d.ts +3 -3
  423. package/dist/treedx/types.d.ts +2 -2
  424. package/dist/treedx/workspace-adapter.d.ts +2 -2
  425. package/dist/treedx-backends.d.ts +13 -11
  426. package/dist/treedx-backends.js +52 -50
  427. package/dist/treedx-client.d.ts +3 -0
  428. package/dist/treedx-client.js +10 -1
  429. package/dist/treeseed/services/compose.yml +2 -3
  430. package/dist/treeseed/template-catalog/catalog.fixture.json +4 -4
  431. package/dist/types/agents.d.ts +256 -0
  432. package/dist/types/agents.js +42 -1
  433. package/dist/verification.d.ts +1 -0
  434. package/dist/verification.js +143 -14
  435. package/dist/workflow/operations.d.ts +510 -559
  436. package/dist/workflow/operations.js +1891 -1342
  437. package/dist/workflow/policy.js +19 -7
  438. package/dist/workflow/runs.d.ts +9 -3
  439. package/dist/workflow/runs.js +66 -26
  440. package/dist/workflow/session.d.ts +4 -1
  441. package/dist/workflow/session.js +50 -10
  442. package/dist/workflow/worktrees.d.ts +6 -2
  443. package/dist/workflow/worktrees.js +98 -15
  444. package/dist/workflow-state.d.ts +5 -5
  445. package/dist/workflow-state.js +27 -17
  446. package/dist/workflow-support.d.ts +26 -25
  447. package/dist/workflow-support.js +27 -31
  448. package/dist/workflow.d.ts +46 -16
  449. package/dist/workflow.js +19 -7
  450. package/drizzle/d1/0000_treeseed_d1.sql +0 -18
  451. package/drizzle/market/0000_market_control_plane.sql +1793 -1499
  452. package/drizzle/market/0005_agent_capacity_coordination.sql +145 -0
  453. package/drizzle/market/0006_provider_assignment_lifecycle.sql +9 -0
  454. package/drizzle/market/0007_agent_architecture_gap_closure.sql +157 -0
  455. package/drizzle/market/0008_agent_capacity_operational_closure.sql +27 -0
  456. package/drizzle/market/0009_agent_capacity_runtime_hardening.sql +29 -0
  457. package/drizzle/market/0010_secrets_capability_persistence.sql +130 -0
  458. package/drizzle/market/0011_github_app_adapter.sql +47 -0
  459. package/drizzle/market/0012_workday_test_runs.sql +44 -0
  460. package/drizzle/market/0013_runtime_task_lifecycle.sql +39 -0
  461. package/drizzle/market/0014_governance_pipeline.sql +189 -0
  462. package/package.json +75 -18
  463. package/scripts/{verify-driver.mjs → verify-driver.ts} +19 -4
  464. package/templates/github/deploy-web.workflow.yml +12 -8
  465. package/dist/operations/services/mailpit-runtime.d.ts +0 -20
  466. package/dist/operations/services/mailpit-runtime.js +0 -67
  467. package/dist/operations/services/release-candidate.d.ts +0 -60
  468. package/dist/operations/services/release-candidate.js +0 -953
  469. package/dist/scripts/ensure-mailpit.js +0 -48
  470. package/dist/scripts/logs-mailpit.js +0 -2
  471. package/dist/scripts/run-ts.js +0 -45
  472. package/dist/scripts/stop-mailpit.js +0 -5
  473. package/dist/scripts/treeseed-run-ts.js +0 -45
@@ -1,11 +1,64 @@
1
- CREATE TABLE IF NOT EXISTS "agent_messages" (
1
+ CREATE TABLE "agent_capacity_plans" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "team_id" text NOT NULL,
4
+ "project_id" text NOT NULL,
5
+ "decision_id" text NOT NULL,
6
+ "status" text DEFAULT 'draft' NOT NULL,
7
+ "scope_hash" text NOT NULL,
8
+ "allocation_set_id" text,
9
+ "work_day_id" text,
10
+ "expected_credits" real DEFAULT 0 NOT NULL,
11
+ "high_credits" real DEFAULT 0 NOT NULL,
12
+ "work_units_json" text DEFAULT '[]' NOT NULL,
13
+ "capability_needs_json" text DEFAULT '[]' NOT NULL,
14
+ "environment_needs_json" text DEFAULT '[]' NOT NULL,
15
+ "reserves_json" text DEFAULT '{}' NOT NULL,
16
+ "blockers_json" text DEFAULT '[]' NOT NULL,
17
+ "priority_rationale" text,
18
+ "review_json" text DEFAULT '{}' NOT NULL,
19
+ "metadata_json" text DEFAULT '{}' NOT NULL,
20
+ "accepted_at" text,
21
+ "scheduled_at" text,
22
+ "superseded_at" text,
23
+ "created_at" text NOT NULL,
24
+ "updated_at" text NOT NULL
25
+ );
26
+
27
+ CREATE TABLE "agent_messages" (
2
28
  "id" serial PRIMARY KEY NOT NULL,
3
29
  "type" text NOT NULL,
4
30
  "payload_json" text NOT NULL,
5
31
  "created_at" text NOT NULL
6
32
  );
7
33
 
8
- CREATE TABLE IF NOT EXISTS "agent_pool_registrations" (
34
+ CREATE TABLE "agent_mode_runs" (
35
+ "id" text PRIMARY KEY NOT NULL,
36
+ "team_id" text NOT NULL,
37
+ "project_id" text NOT NULL,
38
+ "provider_assignment_id" text NOT NULL,
39
+ "capacity_provider_id" text NOT NULL,
40
+ "execution_provider_id" text,
41
+ "project_agent_class_id" text NOT NULL,
42
+ "agent_id" text,
43
+ "handler_id" text,
44
+ "mode" text NOT NULL,
45
+ "status" text DEFAULT 'queued' NOT NULL,
46
+ "selected_input_json" text DEFAULT '{}' NOT NULL,
47
+ "capacity_envelope_json" text DEFAULT '{}' NOT NULL,
48
+ "outputs_json" text DEFAULT '{}' NOT NULL,
49
+ "trace_refs_json" text DEFAULT '{}' NOT NULL,
50
+ "usage_actual_json" text DEFAULT '{}' NOT NULL,
51
+ "validation_json" text DEFAULT '{}' NOT NULL,
52
+ "fallback_reason" text,
53
+ "started_at" text,
54
+ "completed_at" text,
55
+ "failed_at" text,
56
+ "metadata_json" text DEFAULT '{}' NOT NULL,
57
+ "created_at" text NOT NULL,
58
+ "updated_at" text NOT NULL
59
+ );
60
+
61
+ CREATE TABLE "agent_pool_registrations" (
9
62
  "id" text PRIMARY KEY NOT NULL,
10
63
  "pool_id" text NOT NULL,
11
64
  "project_id" text NOT NULL,
@@ -21,7 +74,7 @@ CREATE TABLE IF NOT EXISTS "agent_pool_registrations" (
21
74
  "updated_at" text NOT NULL
22
75
  );
23
76
 
24
- CREATE TABLE IF NOT EXISTS "agent_pool_scale_decisions" (
77
+ CREATE TABLE "agent_pool_scale_decisions" (
25
78
  "id" text PRIMARY KEY NOT NULL,
26
79
  "pool_id" text NOT NULL,
27
80
  "project_id" text NOT NULL,
@@ -36,7 +89,7 @@ CREATE TABLE IF NOT EXISTS "agent_pool_scale_decisions" (
36
89
  "updated_at" text NOT NULL
37
90
  );
38
91
 
39
- CREATE TABLE IF NOT EXISTS "agent_pools" (
92
+ CREATE TABLE "agent_pools" (
40
93
  "id" text PRIMARY KEY NOT NULL,
41
94
  "project_id" text NOT NULL,
42
95
  "team_id" text NOT NULL,
@@ -54,14 +107,14 @@ CREATE TABLE IF NOT EXISTS "agent_pools" (
54
107
  "updated_at" text NOT NULL
55
108
  );
56
109
 
57
- CREATE TABLE IF NOT EXISTS "agent_runs" (
110
+ CREATE TABLE "agent_runs" (
58
111
  "run_id" text PRIMARY KEY NOT NULL,
59
112
  "agent_slug" text NOT NULL,
60
113
  "status" text NOT NULL,
61
114
  "created_at" text NOT NULL
62
115
  );
63
116
 
64
- CREATE TABLE IF NOT EXISTS "api_tokens" (
117
+ CREATE TABLE "api_tokens" (
65
118
  "id" text PRIMARY KEY NOT NULL,
66
119
  "user_id" text NOT NULL,
67
120
  "kind" text NOT NULL,
@@ -77,7 +130,7 @@ CREATE TABLE IF NOT EXISTS "api_tokens" (
77
130
  "updated_at" text NOT NULL
78
131
  );
79
132
 
80
- CREATE TABLE IF NOT EXISTS "approval_requests" (
133
+ CREATE TABLE "approval_requests" (
81
134
  "id" text PRIMARY KEY NOT NULL,
82
135
  "team_id" text NOT NULL,
83
136
  "project_id" text NOT NULL,
@@ -103,7 +156,7 @@ CREATE TABLE IF NOT EXISTS "approval_requests" (
103
156
  "updated_at" text NOT NULL
104
157
  );
105
158
 
106
- CREATE TABLE IF NOT EXISTS "audit_events" (
159
+ CREATE TABLE "audit_events" (
107
160
  "id" text PRIMARY KEY NOT NULL,
108
161
  "actor_type" text NOT NULL,
109
162
  "actor_id" text,
@@ -114,7 +167,7 @@ CREATE TABLE IF NOT EXISTS "audit_events" (
114
167
  "created_at" text NOT NULL
115
168
  );
116
169
 
117
- CREATE TABLE IF NOT EXISTS "auth_sessions" (
170
+ CREATE TABLE "auth_sessions" (
118
171
  "id" text PRIMARY KEY NOT NULL,
119
172
  "user_id" text NOT NULL,
120
173
  "session_type" text NOT NULL,
@@ -127,7 +180,7 @@ CREATE TABLE IF NOT EXISTS "auth_sessions" (
127
180
  "updated_at" text NOT NULL
128
181
  );
129
182
 
130
- CREATE TABLE IF NOT EXISTS "better_auth_account" (
183
+ CREATE TABLE "better_auth_account" (
131
184
  "id" text PRIMARY KEY NOT NULL,
132
185
  "accountId" text NOT NULL,
133
186
  "providerId" text NOT NULL,
@@ -143,7 +196,7 @@ CREATE TABLE IF NOT EXISTS "better_auth_account" (
143
196
  "updatedAt" bigint NOT NULL
144
197
  );
145
198
 
146
- CREATE TABLE IF NOT EXISTS "better_auth_session" (
199
+ CREATE TABLE "better_auth_session" (
147
200
  "id" text PRIMARY KEY NOT NULL,
148
201
  "expiresAt" bigint NOT NULL,
149
202
  "token" text NOT NULL,
@@ -155,7 +208,7 @@ CREATE TABLE IF NOT EXISTS "better_auth_session" (
155
208
  CONSTRAINT "better_auth_session_token_unique" UNIQUE("token")
156
209
  );
157
210
 
158
- CREATE TABLE IF NOT EXISTS "better_auth_user" (
211
+ CREATE TABLE "better_auth_user" (
159
212
  "id" text PRIMARY KEY NOT NULL,
160
213
  "name" text NOT NULL,
161
214
  "email" text NOT NULL,
@@ -169,7 +222,7 @@ CREATE TABLE IF NOT EXISTS "better_auth_user" (
169
222
  CONSTRAINT "better_auth_user_email_unique" UNIQUE("email")
170
223
  );
171
224
 
172
- CREATE TABLE IF NOT EXISTS "better_auth_verification" (
225
+ CREATE TABLE "better_auth_verification" (
173
226
  "id" text PRIMARY KEY NOT NULL,
174
227
  "identifier" text NOT NULL,
175
228
  "value" text NOT NULL,
@@ -178,7 +231,24 @@ CREATE TABLE IF NOT EXISTS "better_auth_verification" (
178
231
  "updatedAt" bigint NOT NULL
179
232
  );
180
233
 
181
- CREATE TABLE IF NOT EXISTS "capacity_grants" (
234
+ CREATE TABLE "capacity_allocation_sets" (
235
+ "id" text PRIMARY KEY NOT NULL,
236
+ "team_id" text NOT NULL,
237
+ "version" text NOT NULL,
238
+ "status" text DEFAULT 'draft' NOT NULL,
239
+ "effective_from" text,
240
+ "effective_until" text,
241
+ "policy_json" text DEFAULT '{}' NOT NULL,
242
+ "slices_json" text DEFAULT '[]' NOT NULL,
243
+ "metadata_json" text DEFAULT '{}' NOT NULL,
244
+ "created_by_id" text,
245
+ "activated_at" text,
246
+ "superseded_by_id" text,
247
+ "created_at" text NOT NULL,
248
+ "updated_at" text NOT NULL
249
+ );
250
+
251
+ CREATE TABLE "capacity_grants" (
182
252
  "id" text PRIMARY KEY NOT NULL,
183
253
  "capacity_provider_id" text NOT NULL,
184
254
  "lane_id" text,
@@ -200,11 +270,14 @@ CREATE TABLE IF NOT EXISTS "capacity_grants" (
200
270
  "updated_at" text NOT NULL
201
271
  );
202
272
 
203
- CREATE TABLE IF NOT EXISTS "capacity_ledger_entries" (
273
+ CREATE TABLE "capacity_ledger_entries" (
204
274
  "id" text PRIMARY KEY NOT NULL,
205
275
  "capacity_provider_id" text NOT NULL,
206
276
  "lane_id" text,
207
277
  "reservation_id" text,
278
+ "assignment_id" text,
279
+ "mode_run_id" text,
280
+ "mode" text,
208
281
  "team_id" text NOT NULL,
209
282
  "project_id" text,
210
283
  "work_day_id" text,
@@ -218,7 +291,7 @@ CREATE TABLE IF NOT EXISTS "capacity_ledger_entries" (
218
291
  "created_at" text NOT NULL
219
292
  );
220
293
 
221
- CREATE TABLE IF NOT EXISTS "capacity_provider_api_keys" (
294
+ CREATE TABLE "capacity_provider_api_keys" (
222
295
  "id" text PRIMARY KEY NOT NULL,
223
296
  "capacity_provider_id" text NOT NULL,
224
297
  "team_id" text NOT NULL,
@@ -236,7 +309,7 @@ CREATE TABLE IF NOT EXISTS "capacity_provider_api_keys" (
236
309
  "updated_at" text NOT NULL
237
310
  );
238
311
 
239
- CREATE TABLE IF NOT EXISTS "capacity_provider_deployments" (
312
+ CREATE TABLE "capacity_provider_deployments" (
240
313
  "id" text PRIMARY KEY NOT NULL,
241
314
  "team_id" text NOT NULL,
242
315
  "capacity_provider_id" text NOT NULL,
@@ -255,7 +328,7 @@ CREATE TABLE IF NOT EXISTS "capacity_provider_deployments" (
255
328
  "completed_at" text
256
329
  );
257
330
 
258
- CREATE TABLE IF NOT EXISTS "capacity_provider_hosts" (
331
+ CREATE TABLE "capacity_provider_hosts" (
259
332
  "id" text PRIMARY KEY NOT NULL,
260
333
  "capacity_provider_id" text NOT NULL,
261
334
  "host_id" text NOT NULL,
@@ -266,7 +339,7 @@ CREATE TABLE IF NOT EXISTS "capacity_provider_hosts" (
266
339
  "updated_at" text NOT NULL
267
340
  );
268
341
 
269
- CREATE TABLE IF NOT EXISTS "capacity_provider_lanes" (
342
+ CREATE TABLE "capacity_provider_lanes" (
270
343
  "id" text PRIMARY KEY NOT NULL,
271
344
  "capacity_provider_id" text NOT NULL,
272
345
  "name" text NOT NULL,
@@ -283,7 +356,7 @@ CREATE TABLE IF NOT EXISTS "capacity_provider_lanes" (
283
356
  "updated_at" text NOT NULL
284
357
  );
285
358
 
286
- CREATE TABLE IF NOT EXISTS "capacity_provider_registrations" (
359
+ CREATE TABLE "capacity_provider_registrations" (
287
360
  "id" text PRIMARY KEY NOT NULL,
288
361
  "capacity_provider_id" text NOT NULL,
289
362
  "team_id" text NOT NULL,
@@ -300,7 +373,7 @@ CREATE TABLE IF NOT EXISTS "capacity_provider_registrations" (
300
373
  "updated_at" text NOT NULL
301
374
  );
302
375
 
303
- CREATE TABLE IF NOT EXISTS "capacity_providers" (
376
+ CREATE TABLE "capacity_providers" (
304
377
  "id" text PRIMARY KEY NOT NULL,
305
378
  "team_id" text,
306
379
  "owner_team_id" text,
@@ -320,11 +393,15 @@ CREATE TABLE IF NOT EXISTS "capacity_providers" (
320
393
  "updated_at" text NOT NULL
321
394
  );
322
395
 
323
- CREATE TABLE IF NOT EXISTS "capacity_reservations" (
396
+ CREATE TABLE "capacity_reservations" (
324
397
  "id" text PRIMARY KEY NOT NULL,
325
398
  "capacity_provider_id" text NOT NULL,
326
399
  "execution_provider_id" text,
327
400
  "lane_id" text NOT NULL,
401
+ "allocation_set_id" text,
402
+ "project_agent_class_id" text,
403
+ "assignment_id" text,
404
+ "mode" text,
328
405
  "team_id" text NOT NULL,
329
406
  "project_id" text NOT NULL,
330
407
  "work_day_id" text,
@@ -345,7 +422,7 @@ CREATE TABLE IF NOT EXISTS "capacity_reservations" (
345
422
  "updated_at" text NOT NULL
346
423
  );
347
424
 
348
- CREATE TABLE IF NOT EXISTS "capacity_routing_decisions" (
425
+ CREATE TABLE "capacity_routing_decisions" (
349
426
  "id" text PRIMARY KEY NOT NULL,
350
427
  "task_id" text,
351
428
  "work_day_id" text,
@@ -361,7 +438,7 @@ CREATE TABLE IF NOT EXISTS "capacity_routing_decisions" (
361
438
  "created_at" text NOT NULL
362
439
  );
363
440
 
364
- CREATE TABLE IF NOT EXISTS "catalog_artifact_versions" (
441
+ CREATE TABLE "catalog_artifact_versions" (
365
442
  "id" text PRIMARY KEY NOT NULL,
366
443
  "item_id" text NOT NULL,
367
444
  "team_id" text NOT NULL,
@@ -375,7 +452,7 @@ CREATE TABLE IF NOT EXISTS "catalog_artifact_versions" (
375
452
  "updated_at" text NOT NULL
376
453
  );
377
454
 
378
- CREATE TABLE IF NOT EXISTS "catalog_item_collaborators" (
455
+ CREATE TABLE "catalog_item_collaborators" (
379
456
  "id" text PRIMARY KEY NOT NULL,
380
457
  "item_id" text NOT NULL,
381
458
  "subject_type" text NOT NULL,
@@ -386,7 +463,7 @@ CREATE TABLE IF NOT EXISTS "catalog_item_collaborators" (
386
463
  "updated_at" text NOT NULL
387
464
  );
388
465
 
389
- CREATE TABLE IF NOT EXISTS "catalog_items" (
466
+ CREATE TABLE "catalog_items" (
390
467
  "id" text PRIMARY KEY NOT NULL,
391
468
  "team_id" text NOT NULL,
392
469
  "kind" text NOT NULL,
@@ -404,14 +481,818 @@ CREATE TABLE IF NOT EXISTS "catalog_items" (
404
481
  "updated_at" text NOT NULL
405
482
  );
406
483
 
407
- CREATE TABLE IF NOT EXISTS "contact_submissions" (
484
+ CREATE TABLE "client_encrypted_escrow_records" (
485
+ "id" text PRIMARY KEY NOT NULL,
486
+ "team_id" text NOT NULL,
487
+ "project_id" text,
488
+ "secret_id" text NOT NULL,
489
+ "status" text DEFAULT 'active' NOT NULL,
490
+ "ciphertext_ref" text NOT NULL,
491
+ "algorithm" text NOT NULL,
492
+ "wrapping_key_id" text NOT NULL,
493
+ "created_by_client_id" text,
494
+ "expires_at" text,
495
+ "migrated_to" text,
496
+ "metadata_json" text DEFAULT '{}' NOT NULL,
497
+ "created_at" text NOT NULL,
498
+ "updated_at" text NOT NULL,
499
+ "tombstoned_at" text
500
+ );
501
+
502
+ CREATE TABLE "commerce_buyer_stripe_customers" (
503
+ "id" text PRIMARY KEY NOT NULL,
504
+ "buyer_team_id" text,
505
+ "buyer_user_id" text,
506
+ "vendor_id" text NOT NULL,
507
+ "connected_account_id" text NOT NULL,
508
+ "environment" text DEFAULT 'test' NOT NULL,
509
+ "stripe_customer_id" text NOT NULL,
510
+ "metadata_json" text DEFAULT '{}' NOT NULL,
511
+ "created_at" text NOT NULL,
512
+ "updated_at" text NOT NULL
513
+ );
514
+
515
+ CREATE TABLE "commerce_capacity_listing_inquiries" (
516
+ "id" text PRIMARY KEY NOT NULL,
517
+ "listing_id" text NOT NULL,
518
+ "product_id" text NOT NULL,
519
+ "vendor_id" text NOT NULL,
520
+ "seller_team_id" text NOT NULL,
521
+ "buyer_team_id" text,
522
+ "buyer_user_id" text,
523
+ "status" text DEFAULT 'requested' NOT NULL,
524
+ "requested_service_type" text,
525
+ "requested_scope" text NOT NULL,
526
+ "data_access_requested_json" text DEFAULT '{}' NOT NULL,
527
+ "secret_access_requested_json" text DEFAULT '{}' NOT NULL,
528
+ "related_project_id" text,
529
+ "related_workday_id" text,
530
+ "governance_evidence_json" text DEFAULT '{}' NOT NULL,
531
+ "metadata_json" text DEFAULT '{}' NOT NULL,
532
+ "created_at" text NOT NULL,
533
+ "updated_at" text NOT NULL
534
+ );
535
+
536
+ CREATE TABLE "commerce_capacity_listings" (
537
+ "id" text PRIMARY KEY NOT NULL,
538
+ "product_id" text NOT NULL,
539
+ "vendor_id" text NOT NULL,
540
+ "seller_team_id" text NOT NULL,
541
+ "capacity_provider_id" text,
542
+ "capacity_provider_lane_id" text,
543
+ "status" text DEFAULT 'draft' NOT NULL,
544
+ "access_level" text DEFAULT 'public_summary' NOT NULL,
545
+ "runtime_isolation_level" text DEFAULT 'none' NOT NULL,
546
+ "human_involvement_level" text DEFAULT 'none' NOT NULL,
547
+ "ai_involvement_level" text DEFAULT 'none' NOT NULL,
548
+ "data_access_level" text DEFAULT 'none' NOT NULL,
549
+ "secret_access_level" text DEFAULT 'none' NOT NULL,
550
+ "supported_service_types_json" text DEFAULT '[]' NOT NULL,
551
+ "supported_regions_json" text DEFAULT '[]' NOT NULL,
552
+ "runtime_requirements_json" text DEFAULT '{}' NOT NULL,
553
+ "data_handling_summary" text,
554
+ "buyer_visible_risk_summary" text,
555
+ "governance_requirements_json" text DEFAULT '{}' NOT NULL,
556
+ "support_policy" text,
557
+ "availability_summary" text,
558
+ "ownership_snapshot_json" text DEFAULT '{}' NOT NULL,
559
+ "metadata_json" text DEFAULT '{}' NOT NULL,
560
+ "created_at" text NOT NULL,
561
+ "updated_at" text NOT NULL
562
+ );
563
+
564
+ CREATE TABLE "commerce_cart_items" (
565
+ "id" text PRIMARY KEY NOT NULL,
566
+ "cart_id" text NOT NULL,
567
+ "vendor_id" text NOT NULL,
568
+ "seller_team_id" text NOT NULL,
569
+ "product_id" text NOT NULL,
570
+ "product_version_id" text,
571
+ "offer_id" text NOT NULL,
572
+ "price_id" text,
573
+ "quantity" integer DEFAULT 1 NOT NULL,
574
+ "unit_amount" integer DEFAULT 0 NOT NULL,
575
+ "currency" text NOT NULL,
576
+ "mode" text NOT NULL,
577
+ "status" text DEFAULT 'active' NOT NULL,
578
+ "metadata_json" text DEFAULT '{}' NOT NULL,
579
+ "created_at" text NOT NULL,
580
+ "updated_at" text NOT NULL
581
+ );
582
+
583
+ CREATE TABLE "commerce_carts" (
584
+ "id" text PRIMARY KEY NOT NULL,
585
+ "buyer_team_id" text,
586
+ "buyer_user_id" text,
587
+ "status" text DEFAULT 'active' NOT NULL,
588
+ "currency" text,
589
+ "metadata_json" text DEFAULT '{}' NOT NULL,
590
+ "created_at" text NOT NULL,
591
+ "updated_at" text NOT NULL
592
+ );
593
+
594
+ CREATE TABLE "commerce_checkouts" (
595
+ "id" text PRIMARY KEY NOT NULL,
596
+ "cart_id" text NOT NULL,
597
+ "buyer_team_id" text,
598
+ "buyer_user_id" text,
599
+ "status" text DEFAULT 'draft' NOT NULL,
600
+ "checkout_mode" text DEFAULT 'stripe_elements_grouped_vendor' NOT NULL,
601
+ "group_count" integer DEFAULT 0 NOT NULL,
602
+ "completed_group_count" integer DEFAULT 0 NOT NULL,
603
+ "metadata_json" text DEFAULT '{}' NOT NULL,
604
+ "created_at" text NOT NULL,
605
+ "updated_at" text NOT NULL
606
+ );
607
+
608
+ CREATE TABLE "commerce_contributions" (
609
+ "id" text PRIMARY KEY NOT NULL,
610
+ "product_id" text NOT NULL,
611
+ "product_version_id" text,
612
+ "contributor_type" text NOT NULL,
613
+ "contributor_id" text,
614
+ "display_name" text,
615
+ "role" text NOT NULL,
616
+ "summary" text,
617
+ "attribution_visibility" text DEFAULT 'public' NOT NULL,
618
+ "agreement_ref" text,
619
+ "benefit_weight" real,
620
+ "effective_at" text NOT NULL,
621
+ "metadata_json" text DEFAULT '{}' NOT NULL,
622
+ "created_at" text NOT NULL,
623
+ "updated_at" text NOT NULL
624
+ );
625
+
626
+ CREATE TABLE "commerce_entitlements" (
627
+ "id" text PRIMARY KEY NOT NULL,
628
+ "buyer_team_id" text,
629
+ "buyer_user_id" text,
630
+ "seller_team_id" text NOT NULL,
631
+ "product_id" text NOT NULL,
632
+ "product_version_id" text,
633
+ "offer_id" text NOT NULL,
634
+ "order_id" text,
635
+ "order_item_id" text,
636
+ "subscription_id" text,
637
+ "status" text DEFAULT 'pending' NOT NULL,
638
+ "access_scope_json" text DEFAULT '{}' NOT NULL,
639
+ "starts_at" text,
640
+ "ends_at" text,
641
+ "renewal_state" text DEFAULT 'none' NOT NULL,
642
+ "fulfillment_artifact_refs_json" text DEFAULT '[]' NOT NULL,
643
+ "project_id" text,
644
+ "catalog_item_id" text,
645
+ "ownership_snapshot_json" text DEFAULT '{}' NOT NULL,
646
+ "metadata_json" text DEFAULT '{}' NOT NULL,
647
+ "created_at" text NOT NULL,
648
+ "updated_at" text NOT NULL
649
+ );
650
+
651
+ CREATE TABLE "commerce_fulfillment_events" (
652
+ "id" text PRIMARY KEY NOT NULL,
653
+ "order_id" text NOT NULL,
654
+ "order_item_id" text,
655
+ "entitlement_id" text,
656
+ "vendor_id" text NOT NULL,
657
+ "seller_team_id" text NOT NULL,
658
+ "product_id" text NOT NULL,
659
+ "product_version_id" text,
660
+ "catalog_item_id" text,
661
+ "catalog_artifact_version_id" text,
662
+ "event_type" text NOT NULL,
663
+ "status" text DEFAULT 'pending' NOT NULL,
664
+ "artifact_refs_json" text DEFAULT '[]' NOT NULL,
665
+ "delivery_refs_json" text DEFAULT '[]' NOT NULL,
666
+ "message" text,
667
+ "actor_type" text NOT NULL,
668
+ "actor_id" text NOT NULL,
669
+ "metadata_json" text DEFAULT '{}' NOT NULL,
670
+ "created_at" text NOT NULL
671
+ );
672
+
673
+ CREATE TABLE "commerce_governance_events" (
674
+ "id" text PRIMARY KEY NOT NULL,
675
+ "actor_type" text NOT NULL,
676
+ "actor_id" text,
677
+ "action" text NOT NULL,
678
+ "object_type" text NOT NULL,
679
+ "object_id" text NOT NULL,
680
+ "prior_state" text,
681
+ "next_state" text,
682
+ "reason" text,
683
+ "evidence_json" text DEFAULT '{}' NOT NULL,
684
+ "related_order_id" text,
685
+ "related_offer_id" text,
686
+ "related_product_id" text,
687
+ "related_team_id" text,
688
+ "created_at" text NOT NULL
689
+ );
690
+
691
+ CREATE TABLE "commerce_governance_policies" (
692
+ "id" text PRIMARY KEY NOT NULL,
693
+ "product_id" text,
694
+ "team_id" text,
695
+ "policy_kind" text NOT NULL,
696
+ "title" text NOT NULL,
697
+ "approval_rules_json" text DEFAULT '{}' NOT NULL,
698
+ "quorum_rules_json" text DEFAULT '{}' NOT NULL,
699
+ "buyer_visible_summary" text,
700
+ "status" text DEFAULT 'draft' NOT NULL,
701
+ "created_at" text NOT NULL,
702
+ "updated_at" text NOT NULL
703
+ );
704
+
705
+ CREATE TABLE "commerce_offers" (
706
+ "id" text PRIMARY KEY NOT NULL,
707
+ "product_id" text NOT NULL,
708
+ "product_version_id" text,
709
+ "vendor_id" text NOT NULL,
710
+ "seller_team_id" text NOT NULL,
711
+ "mode" text NOT NULL,
712
+ "status" text DEFAULT 'draft' NOT NULL,
713
+ "title" text NOT NULL,
714
+ "terms_summary" text,
715
+ "access_scope_json" text DEFAULT '{}' NOT NULL,
716
+ "support_scope_json" text DEFAULT '{}' NOT NULL,
717
+ "fulfillment_mode" text DEFAULT 'automatic' NOT NULL,
718
+ "active_price_id" text,
719
+ "stripe_product_id" text,
720
+ "stripe_product_status" text DEFAULT 'not_synced' NOT NULL,
721
+ "stripe_product_synced_at" text,
722
+ "stripe_product_sync_error" text,
723
+ "stripe_product_metadata_json" text DEFAULT '{}' NOT NULL,
724
+ "starts_at" text,
725
+ "ends_at" text,
726
+ "metadata_json" text DEFAULT '{}' NOT NULL,
727
+ "created_at" text NOT NULL,
728
+ "updated_at" text NOT NULL
729
+ );
730
+
731
+ CREATE TABLE "commerce_order_items" (
732
+ "id" text PRIMARY KEY NOT NULL,
733
+ "order_id" text NOT NULL,
734
+ "vendor_id" text NOT NULL,
735
+ "seller_team_id" text NOT NULL,
736
+ "product_id" text NOT NULL,
737
+ "product_version_id" text,
738
+ "offer_id" text NOT NULL,
739
+ "price_id" text,
740
+ "mode" text NOT NULL,
741
+ "quantity" integer DEFAULT 1 NOT NULL,
742
+ "unit_amount" integer DEFAULT 0 NOT NULL,
743
+ "total_amount" integer DEFAULT 0 NOT NULL,
744
+ "refunded_amount" integer DEFAULT 0 NOT NULL,
745
+ "refund_status" text DEFAULT 'none' NOT NULL,
746
+ "currency" text NOT NULL,
747
+ "status" text DEFAULT 'pending' NOT NULL,
748
+ "entitlement_id" text,
749
+ "ownership_snapshot_json" text DEFAULT '{}' NOT NULL,
750
+ "access_scope_json" text DEFAULT '{}' NOT NULL,
751
+ "support_scope_json" text DEFAULT '{}' NOT NULL,
752
+ "metadata_json" text DEFAULT '{}' NOT NULL,
753
+ "created_at" text NOT NULL,
754
+ "updated_at" text NOT NULL
755
+ );
756
+
757
+ CREATE TABLE "commerce_orders" (
758
+ "id" text PRIMARY KEY NOT NULL,
759
+ "checkout_id" text,
760
+ "cart_id" text,
761
+ "buyer_team_id" text,
762
+ "buyer_user_id" text,
763
+ "vendor_id" text,
764
+ "seller_team_id" text,
765
+ "status" text DEFAULT 'draft' NOT NULL,
766
+ "currency" text NOT NULL,
767
+ "subtotal_amount" integer DEFAULT 0 NOT NULL,
768
+ "total_amount" integer DEFAULT 0 NOT NULL,
769
+ "refunded_amount" integer DEFAULT 0 NOT NULL,
770
+ "refund_status" text DEFAULT 'none' NOT NULL,
771
+ "stripe_checkout_session_id" text,
772
+ "stripe_payment_intent_id" text,
773
+ "stripe_subscription_id" text,
774
+ "stripe_customer_id" text,
775
+ "stripe_connected_account_id" text,
776
+ "ownership_snapshot_json" text DEFAULT '{}' NOT NULL,
777
+ "metadata_json" text DEFAULT '{}' NOT NULL,
778
+ "created_at" text NOT NULL,
779
+ "updated_at" text NOT NULL
780
+ );
781
+
782
+ CREATE TABLE "commerce_ownership_records" (
783
+ "id" text PRIMARY KEY NOT NULL,
784
+ "product_id" text NOT NULL,
785
+ "model" text NOT NULL,
786
+ "canonical_owner_type" text NOT NULL,
787
+ "canonical_owner_id" text,
788
+ "seller_team_id" text NOT NULL,
789
+ "steward_team_id" text,
790
+ "governance_policy_id" text,
791
+ "public_summary" text,
792
+ "buyer_visible" integer DEFAULT 1 NOT NULL,
793
+ "effective_at" text NOT NULL,
794
+ "superseded_at" text,
795
+ "metadata_json" text DEFAULT '{}' NOT NULL,
796
+ "created_at" text NOT NULL,
797
+ "updated_at" text NOT NULL
798
+ );
799
+
800
+ CREATE TABLE "commerce_ownership_transfers" (
801
+ "id" text PRIMARY KEY NOT NULL,
802
+ "product_id" text NOT NULL,
803
+ "from_ownership_record_id" text NOT NULL,
804
+ "to_ownership_record_id" text NOT NULL,
805
+ "status" text DEFAULT 'draft' NOT NULL,
806
+ "reason" text NOT NULL,
807
+ "approval_evidence_json" text DEFAULT '{}' NOT NULL,
808
+ "buyer_visible_impact" text,
809
+ "effective_at" text NOT NULL,
810
+ "requested_by_type" text DEFAULT 'user' NOT NULL,
811
+ "requested_by_id" text DEFAULT 'system' NOT NULL,
812
+ "approved_by_type" text,
813
+ "approved_by_id" text,
814
+ "approved_at" text,
815
+ "rejected_at" text,
816
+ "superseded_at" text,
817
+ "metadata_json" text DEFAULT '{}' NOT NULL,
818
+ "created_at" text NOT NULL
819
+ );
820
+
821
+ CREATE TABLE "commerce_payment_groups" (
822
+ "id" text PRIMARY KEY NOT NULL,
823
+ "checkout_id" text NOT NULL,
824
+ "order_id" text NOT NULL,
825
+ "vendor_id" text NOT NULL,
826
+ "seller_team_id" text NOT NULL,
827
+ "connected_account_id" text,
828
+ "group_kind" text NOT NULL,
829
+ "billing_interval" text,
830
+ "status" text DEFAULT 'pending' NOT NULL,
831
+ "currency" text NOT NULL,
832
+ "subtotal_amount" integer DEFAULT 0 NOT NULL,
833
+ "total_amount" integer DEFAULT 0 NOT NULL,
834
+ "stripe_payment_intent_id" text,
835
+ "stripe_subscription_id" text,
836
+ "stripe_customer_id" text,
837
+ "client_secret_last4" text,
838
+ "metadata_json" text DEFAULT '{}' NOT NULL,
839
+ "created_at" text NOT NULL,
840
+ "updated_at" text NOT NULL
841
+ );
842
+
843
+ CREATE TABLE "commerce_prices" (
844
+ "id" text PRIMARY KEY NOT NULL,
845
+ "offer_id" text NOT NULL,
846
+ "amount" integer NOT NULL,
847
+ "currency" text NOT NULL,
848
+ "billing_interval" text NOT NULL,
849
+ "status" text DEFAULT 'draft' NOT NULL,
850
+ "stripe_product_id" text,
851
+ "stripe_price_id" text,
852
+ "stripe_lookup_key" text,
853
+ "stripe_sync_status" text DEFAULT 'not_synced' NOT NULL,
854
+ "stripe_synced_at" text,
855
+ "stripe_sync_error" text,
856
+ "stripe_metadata_json" text DEFAULT '{}' NOT NULL,
857
+ "price_version" integer DEFAULT 1 NOT NULL,
858
+ "tax_behavior" text DEFAULT 'unspecified' NOT NULL,
859
+ "metadata_json" text DEFAULT '{}' NOT NULL,
860
+ "created_at" text NOT NULL,
861
+ "updated_at" text NOT NULL
862
+ );
863
+
864
+ CREATE TABLE "commerce_product_versions" (
865
+ "id" text PRIMARY KEY NOT NULL,
866
+ "product_id" text NOT NULL,
867
+ "version" text NOT NULL,
868
+ "status" text DEFAULT 'draft' NOT NULL,
869
+ "catalog_artifact_version_id" text,
870
+ "manifest_key" text,
871
+ "artifact_key" text,
872
+ "integrity" text,
873
+ "release_notes" text,
874
+ "compatibility_json" text DEFAULT '{}' NOT NULL,
875
+ "metadata_json" text DEFAULT '{}' NOT NULL,
876
+ "published_at" text,
877
+ "created_at" text NOT NULL,
878
+ "updated_at" text NOT NULL
879
+ );
880
+
881
+ CREATE TABLE "commerce_products" (
882
+ "id" text PRIMARY KEY NOT NULL,
883
+ "vendor_id" text NOT NULL,
884
+ "seller_team_id" text NOT NULL,
885
+ "kind" text NOT NULL,
886
+ "slug" text NOT NULL,
887
+ "title" text NOT NULL,
888
+ "summary" text,
889
+ "description" text,
890
+ "status" text DEFAULT 'draft' NOT NULL,
891
+ "visibility" text DEFAULT 'private' NOT NULL,
892
+ "catalog_item_id" text,
893
+ "current_version_id" text,
894
+ "ownership_model" text DEFAULT 'team_owned' NOT NULL,
895
+ "ownership_record_id" text,
896
+ "support_policy" text,
897
+ "license" text,
898
+ "metadata_json" text DEFAULT '{}' NOT NULL,
899
+ "created_at" text NOT NULL,
900
+ "updated_at" text NOT NULL
901
+ );
902
+
903
+ CREATE TABLE "commerce_refunds" (
904
+ "id" text PRIMARY KEY NOT NULL,
905
+ "order_id" text NOT NULL,
906
+ "order_item_id" text,
907
+ "payment_group_id" text,
908
+ "vendor_id" text NOT NULL,
909
+ "seller_team_id" text NOT NULL,
910
+ "buyer_team_id" text,
911
+ "buyer_user_id" text,
912
+ "amount" integer NOT NULL,
913
+ "currency" text NOT NULL,
914
+ "status" text DEFAULT 'processing' NOT NULL,
915
+ "reason" text,
916
+ "stripe_refund_id" text,
917
+ "stripe_payment_intent_id" text,
918
+ "stripe_connected_account_id" text,
919
+ "idempotency_key" text NOT NULL,
920
+ "requested_by_type" text NOT NULL,
921
+ "requested_by_id" text NOT NULL,
922
+ "failure_reason" text,
923
+ "metadata_json" text DEFAULT '{}' NOT NULL,
924
+ "created_at" text NOT NULL,
925
+ "updated_at" text NOT NULL
926
+ );
927
+
928
+ CREATE TABLE "commerce_service_contracts" (
929
+ "id" text PRIMARY KEY NOT NULL,
930
+ "request_id" text NOT NULL,
931
+ "quote_id" text NOT NULL,
932
+ "vendor_id" text NOT NULL,
933
+ "seller_team_id" text NOT NULL,
934
+ "buyer_team_id" text,
935
+ "buyer_user_id" text,
936
+ "product_id" text NOT NULL,
937
+ "offer_id" text NOT NULL,
938
+ "status" text DEFAULT 'pending_checkout' NOT NULL,
939
+ "amount" integer NOT NULL,
940
+ "currency" text NOT NULL,
941
+ "order_id" text,
942
+ "order_item_id" text,
943
+ "payment_group_id" text,
944
+ "entitlement_id" text,
945
+ "related_project_id" text,
946
+ "related_workday_id" text,
947
+ "ownership_snapshot_json" text DEFAULT '{}' NOT NULL,
948
+ "access_approval_snapshot_json" text DEFAULT '{}' NOT NULL,
949
+ "fulfillment_summary" text,
950
+ "metadata_json" text DEFAULT '{}' NOT NULL,
951
+ "created_at" text NOT NULL,
952
+ "updated_at" text NOT NULL
953
+ );
954
+
955
+ CREATE TABLE "commerce_service_events" (
956
+ "id" text PRIMARY KEY NOT NULL,
957
+ "request_id" text NOT NULL,
958
+ "quote_id" text,
959
+ "contract_id" text,
960
+ "event_type" text NOT NULL,
961
+ "actor_type" text NOT NULL,
962
+ "actor_id" text,
963
+ "prior_state" text,
964
+ "next_state" text,
965
+ "message" text,
966
+ "evidence_json" text DEFAULT '{}' NOT NULL,
967
+ "created_at" text NOT NULL
968
+ );
969
+
970
+ CREATE TABLE "commerce_service_quotes" (
971
+ "id" text PRIMARY KEY NOT NULL,
972
+ "request_id" text NOT NULL,
973
+ "vendor_id" text NOT NULL,
974
+ "seller_team_id" text NOT NULL,
975
+ "buyer_team_id" text,
976
+ "buyer_user_id" text,
977
+ "quote_version" integer DEFAULT 1 NOT NULL,
978
+ "status" text DEFAULT 'draft' NOT NULL,
979
+ "title" text NOT NULL,
980
+ "scope_summary" text NOT NULL,
981
+ "deliverables_json" text DEFAULT '[]' NOT NULL,
982
+ "assumptions_json" text DEFAULT '[]' NOT NULL,
983
+ "access_requirements_json" text DEFAULT '{}' NOT NULL,
984
+ "governance_requirements_json" text DEFAULT '{}' NOT NULL,
985
+ "amount" integer NOT NULL,
986
+ "currency" text NOT NULL,
987
+ "expires_at" text,
988
+ "buyer_approved_at" text,
989
+ "vendor_approved_at" text,
990
+ "accepted_at" text,
991
+ "rejected_at" text,
992
+ "metadata_json" text DEFAULT '{}' NOT NULL,
993
+ "created_at" text NOT NULL,
994
+ "updated_at" text NOT NULL
995
+ );
996
+
997
+ CREATE TABLE "commerce_service_requests" (
998
+ "id" text PRIMARY KEY NOT NULL,
999
+ "buyer_team_id" text,
1000
+ "buyer_user_id" text,
1001
+ "vendor_id" text NOT NULL,
1002
+ "seller_team_id" text NOT NULL,
1003
+ "product_id" text NOT NULL,
1004
+ "offer_id" text NOT NULL,
1005
+ "status" text DEFAULT 'requested' NOT NULL,
1006
+ "requested_scope" text NOT NULL,
1007
+ "approved_scope" text,
1008
+ "access_needs_json" text DEFAULT '{}' NOT NULL,
1009
+ "buyer_visible_summary" text,
1010
+ "vendor_private_notes" text,
1011
+ "active_quote_id" text,
1012
+ "approved_quote_id" text,
1013
+ "contract_id" text,
1014
+ "related_project_id" text,
1015
+ "related_workday_id" text,
1016
+ "order_id" text,
1017
+ "entitlement_id" text,
1018
+ "ownership_snapshot_json" text DEFAULT '{}' NOT NULL,
1019
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1020
+ "created_at" text NOT NULL,
1021
+ "updated_at" text NOT NULL
1022
+ );
1023
+
1024
+ CREATE TABLE "commerce_stewardship_assignments" (
1025
+ "id" text PRIMARY KEY NOT NULL,
1026
+ "ownership_record_id" text NOT NULL,
1027
+ "product_id" text NOT NULL,
1028
+ "role" text NOT NULL,
1029
+ "assignee_type" text NOT NULL,
1030
+ "assignee_id" text,
1031
+ "display_name" text,
1032
+ "responsibilities_json" text DEFAULT '[]' NOT NULL,
1033
+ "visible_to_buyers" integer DEFAULT 1 NOT NULL,
1034
+ "starts_at" text NOT NULL,
1035
+ "ends_at" text,
1036
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1037
+ "created_at" text NOT NULL,
1038
+ "updated_at" text NOT NULL
1039
+ );
1040
+
1041
+ CREATE TABLE "commerce_subscriptions" (
1042
+ "id" text PRIMARY KEY NOT NULL,
1043
+ "order_id" text NOT NULL,
1044
+ "vendor_id" text NOT NULL,
1045
+ "seller_team_id" text NOT NULL,
1046
+ "buyer_team_id" text,
1047
+ "buyer_user_id" text,
1048
+ "offer_id" text NOT NULL,
1049
+ "price_id" text NOT NULL,
1050
+ "status" text NOT NULL,
1051
+ "renewal_state" text DEFAULT 'active' NOT NULL,
1052
+ "stripe_subscription_id" text NOT NULL,
1053
+ "stripe_customer_id" text,
1054
+ "stripe_connected_account_id" text NOT NULL,
1055
+ "current_period_start" text,
1056
+ "current_period_end" text,
1057
+ "cancel_at_period_end" integer DEFAULT 0 NOT NULL,
1058
+ "canceled_at" text,
1059
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1060
+ "created_at" text NOT NULL,
1061
+ "updated_at" text NOT NULL
1062
+ );
1063
+
1064
+ CREATE TABLE "commerce_succession_events" (
1065
+ "id" text PRIMARY KEY NOT NULL,
1066
+ "product_id" text NOT NULL,
1067
+ "ownership_record_id" text,
1068
+ "stewardship_assignment_id" text,
1069
+ "successor_type" text NOT NULL,
1070
+ "successor_id" text NOT NULL,
1071
+ "event_type" text NOT NULL,
1072
+ "status" text DEFAULT 'submitted' NOT NULL,
1073
+ "reason" text,
1074
+ "evidence_json" text DEFAULT '{}' NOT NULL,
1075
+ "effective_at" text,
1076
+ "created_by_type" text NOT NULL,
1077
+ "created_by_id" text NOT NULL,
1078
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1079
+ "created_at" text NOT NULL
1080
+ );
1081
+
1082
+ CREATE TABLE "commerce_vendor_stripe_accounts" (
1083
+ "id" text PRIMARY KEY NOT NULL,
1084
+ "vendor_id" text NOT NULL,
1085
+ "team_id" text NOT NULL,
1086
+ "environment" text DEFAULT 'test' NOT NULL,
1087
+ "stripe_account_id" text NOT NULL,
1088
+ "account_status" text DEFAULT 'pending' NOT NULL,
1089
+ "onboarding_status" text DEFAULT 'not_started' NOT NULL,
1090
+ "charges_enabled" integer DEFAULT 0 NOT NULL,
1091
+ "payouts_enabled" integer DEFAULT 0 NOT NULL,
1092
+ "details_submitted" integer DEFAULT 0 NOT NULL,
1093
+ "requirements_currently_due_json" text DEFAULT '[]' NOT NULL,
1094
+ "requirements_eventually_due_json" text DEFAULT '[]' NOT NULL,
1095
+ "requirements_past_due_json" text DEFAULT '[]' NOT NULL,
1096
+ "requirements_disabled_reason" text,
1097
+ "capabilities_json" text DEFAULT '{}' NOT NULL,
1098
+ "onboarding_started_at" text,
1099
+ "onboarding_completed_at" text,
1100
+ "last_synced_at" text,
1101
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1102
+ "created_at" text NOT NULL,
1103
+ "updated_at" text NOT NULL
1104
+ );
1105
+
1106
+ CREATE TABLE "commerce_vendors" (
1107
+ "id" text PRIMARY KEY NOT NULL,
1108
+ "team_id" text NOT NULL,
1109
+ "display_name" text NOT NULL,
1110
+ "slug" text NOT NULL,
1111
+ "status" text DEFAULT 'submitted' NOT NULL,
1112
+ "trust_level" text DEFAULT 'public_publisher' NOT NULL,
1113
+ "professional_entitlement_id" text,
1114
+ "stripe_account_id" text,
1115
+ "sales_enabled" integer DEFAULT 0 NOT NULL,
1116
+ "service_sales_enabled" integer DEFAULT 0 NOT NULL,
1117
+ "capacity_listings_enabled" integer DEFAULT 0 NOT NULL,
1118
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1119
+ "created_at" text NOT NULL,
1120
+ "updated_at" text NOT NULL
1121
+ );
1122
+
1123
+ CREATE TABLE "commerce_webhook_events" (
1124
+ "id" text PRIMARY KEY NOT NULL,
1125
+ "provider" text DEFAULT 'stripe' NOT NULL,
1126
+ "environment" text DEFAULT 'test' NOT NULL,
1127
+ "event_id" text NOT NULL,
1128
+ "event_type" text NOT NULL,
1129
+ "connected_account_id" text,
1130
+ "status" text DEFAULT 'received' NOT NULL,
1131
+ "object_type" text,
1132
+ "object_id" text,
1133
+ "related_order_id" text,
1134
+ "related_subscription_id" text,
1135
+ "payload_hash" text NOT NULL,
1136
+ "processing_error" text,
1137
+ "received_at" text NOT NULL,
1138
+ "processed_at" text,
1139
+ "created_at" text NOT NULL,
1140
+ "updated_at" text NOT NULL
1141
+ );
1142
+
1143
+ CREATE TABLE "commons_decisions" (
1144
+ "id" text PRIMARY KEY NOT NULL,
1145
+ "proposal_id" text NOT NULL,
1146
+ "status" text DEFAULT 'proposed' NOT NULL,
1147
+ "decision_record_id" text,
1148
+ "decision_record_slug" text,
1149
+ "title" text NOT NULL,
1150
+ "summary" text NOT NULL,
1151
+ "steward_reason" text,
1152
+ "capacity_budget" text,
1153
+ "scheduled_for" text,
1154
+ "implemented_at" text,
1155
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1156
+ "created_at" text NOT NULL,
1157
+ "updated_at" text NOT NULL
1158
+ );
1159
+
1160
+ CREATE TABLE "commons_delegations" (
1161
+ "id" text PRIMARY KEY NOT NULL,
1162
+ "from_participant_id" text NOT NULL,
1163
+ "to_participant_id" text NOT NULL,
1164
+ "scope" text DEFAULT 'treeseed_commons' NOT NULL,
1165
+ "status" text DEFAULT 'active' NOT NULL,
1166
+ "weight_limit" real,
1167
+ "reason" text,
1168
+ "created_at" text NOT NULL,
1169
+ "revoked_at" text
1170
+ );
1171
+
1172
+ CREATE TABLE "commons_governance_events" (
1173
+ "id" text PRIMARY KEY NOT NULL,
1174
+ "event_type" text NOT NULL,
1175
+ "actor_type" text DEFAULT 'system' NOT NULL,
1176
+ "actor_id" text,
1177
+ "participant_id" text,
1178
+ "proposal_id" text,
1179
+ "question_id" text,
1180
+ "decision_id" text,
1181
+ "prior_state" text,
1182
+ "next_state" text,
1183
+ "message" text,
1184
+ "evidence_json" text DEFAULT '{}' NOT NULL,
1185
+ "created_at" text NOT NULL
1186
+ );
1187
+
1188
+ CREATE TABLE "commons_participants" (
1189
+ "id" text PRIMARY KEY NOT NULL,
1190
+ "user_id" text NOT NULL,
1191
+ "team_id" text NOT NULL,
1192
+ "status" text DEFAULT 'active' NOT NULL,
1193
+ "display_name" text,
1194
+ "verified_email" integer DEFAULT 0 NOT NULL,
1195
+ "base_weight" real DEFAULT 1 NOT NULL,
1196
+ "trust_weight" real DEFAULT 0 NOT NULL,
1197
+ "contribution_weight" real DEFAULT 0 NOT NULL,
1198
+ "stakeholder_weight" real DEFAULT 0 NOT NULL,
1199
+ "delegated_weight" real DEFAULT 0 NOT NULL,
1200
+ "total_weight" real DEFAULT 1 NOT NULL,
1201
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1202
+ "created_at" text NOT NULL,
1203
+ "updated_at" text NOT NULL
1204
+ );
1205
+
1206
+ CREATE TABLE "commons_proposal_backings" (
1207
+ "id" text PRIMARY KEY NOT NULL,
1208
+ "proposal_id" text NOT NULL,
1209
+ "participant_id" text NOT NULL,
1210
+ "user_id" text NOT NULL,
1211
+ "weight_snapshot_id" text NOT NULL,
1212
+ "weight" real NOT NULL,
1213
+ "reason" text,
1214
+ "created_at" text NOT NULL
1215
+ );
1216
+
1217
+ CREATE TABLE "commons_proposal_votes" (
1218
+ "id" text PRIMARY KEY NOT NULL,
1219
+ "proposal_id" text NOT NULL,
1220
+ "participant_id" text NOT NULL,
1221
+ "user_id" text NOT NULL,
1222
+ "vote" text NOT NULL,
1223
+ "weight_snapshot_id" text NOT NULL,
1224
+ "weight" real NOT NULL,
1225
+ "reason" text,
1226
+ "created_at" text NOT NULL,
1227
+ "updated_at" text NOT NULL
1228
+ );
1229
+
1230
+ CREATE TABLE "commons_proposals" (
1231
+ "id" text PRIMARY KEY NOT NULL,
1232
+ "participant_id" text NOT NULL,
1233
+ "user_id" text NOT NULL,
1234
+ "team_id" text NOT NULL,
1235
+ "status" text DEFAULT 'draft' NOT NULL,
1236
+ "title" text NOT NULL,
1237
+ "summary" text NOT NULL,
1238
+ "body" text NOT NULL,
1239
+ "scope" text DEFAULT 'treeseed_commons' NOT NULL,
1240
+ "decision_type" text DEFAULT 'advisory' NOT NULL,
1241
+ "content_proposal_slug" text,
1242
+ "content_decision_slug" text,
1243
+ "backing_count" integer DEFAULT 0 NOT NULL,
1244
+ "vote_support_weight" real DEFAULT 0 NOT NULL,
1245
+ "vote_object_weight" real DEFAULT 0 NOT NULL,
1246
+ "vote_abstain_weight" real DEFAULT 0 NOT NULL,
1247
+ "qualified_at" text,
1248
+ "voting_starts_at" text,
1249
+ "voting_ends_at" text,
1250
+ "steward_decision_at" text,
1251
+ "steward_decision_by" text,
1252
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1253
+ "created_at" text NOT NULL,
1254
+ "updated_at" text NOT NULL
1255
+ );
1256
+
1257
+ CREATE TABLE "commons_questions" (
1258
+ "id" text PRIMARY KEY NOT NULL,
1259
+ "participant_id" text NOT NULL,
1260
+ "user_id" text NOT NULL,
1261
+ "team_id" text NOT NULL,
1262
+ "status" text DEFAULT 'open' NOT NULL,
1263
+ "title" text NOT NULL,
1264
+ "body" text NOT NULL,
1265
+ "answer" text,
1266
+ "converted_proposal_id" text,
1267
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1268
+ "created_at" text NOT NULL,
1269
+ "updated_at" text NOT NULL
1270
+ );
1271
+
1272
+ CREATE TABLE "commons_weight_snapshots" (
1273
+ "id" text PRIMARY KEY NOT NULL,
1274
+ "participant_id" text NOT NULL,
1275
+ "policy_version" text NOT NULL,
1276
+ "base_weight" real DEFAULT 1 NOT NULL,
1277
+ "verified_email_weight" real DEFAULT 0 NOT NULL,
1278
+ "account_age_weight" real DEFAULT 0 NOT NULL,
1279
+ "contribution_weight" real DEFAULT 0 NOT NULL,
1280
+ "stakeholder_weight" real DEFAULT 0 NOT NULL,
1281
+ "trust_role_weight" real DEFAULT 0 NOT NULL,
1282
+ "delegated_weight" real DEFAULT 0 NOT NULL,
1283
+ "total_weight" real DEFAULT 1 NOT NULL,
1284
+ "evidence_json" text DEFAULT '{}' NOT NULL,
1285
+ "created_at" text NOT NULL
1286
+ );
1287
+
1288
+ CREATE TABLE "contact_submissions" (
408
1289
  "id" serial PRIMARY KEY NOT NULL,
409
1290
  "email" text NOT NULL,
410
1291
  "message" text NOT NULL,
411
1292
  "created_at" text NOT NULL
412
1293
  );
413
1294
 
414
- CREATE TABLE IF NOT EXISTS "credit_conversion_profiles" (
1295
+ CREATE TABLE "credit_conversion_profiles" (
415
1296
  "id" text PRIMARY KEY NOT NULL,
416
1297
  "task_signature" text NOT NULL,
417
1298
  "execution_profile_id" text DEFAULT 'standard-code-model' NOT NULL,
@@ -433,7 +1314,7 @@ CREATE TABLE IF NOT EXISTS "credit_conversion_profiles" (
433
1314
  "updated_at" text NOT NULL
434
1315
  );
435
1316
 
436
- CREATE TABLE IF NOT EXISTS "cursor_state" (
1317
+ CREATE TABLE "cursor_state" (
437
1318
  "agent_slug" text,
438
1319
  "cursor_key" text,
439
1320
  "status" text NOT NULL,
@@ -444,7 +1325,42 @@ CREATE TABLE IF NOT EXISTS "cursor_state" (
444
1325
  CONSTRAINT "cursor_state_agent_slug_cursor_key_pk" PRIMARY KEY("agent_slug","cursor_key")
445
1326
  );
446
1327
 
447
- CREATE TABLE IF NOT EXISTS "device_codes" (
1328
+ CREATE TABLE "decision_execution_inputs" (
1329
+ "id" text PRIMARY KEY NOT NULL,
1330
+ "team_id" text NOT NULL,
1331
+ "project_id" text NOT NULL,
1332
+ "decision_id" text NOT NULL,
1333
+ "project_agent_class_id" text NOT NULL,
1334
+ "mode" text DEFAULT 'acting' NOT NULL,
1335
+ "status" text DEFAULT 'proposed' NOT NULL,
1336
+ "scope_hash" text NOT NULL,
1337
+ "input_json" text DEFAULT '{}' NOT NULL,
1338
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1339
+ "accepted_at" text,
1340
+ "revision_requested_at" text,
1341
+ "stale_at" text,
1342
+ "created_at" text NOT NULL,
1343
+ "updated_at" text NOT NULL
1344
+ );
1345
+
1346
+ CREATE TABLE "decision_planning_statuses" (
1347
+ "id" text PRIMARY KEY NOT NULL,
1348
+ "team_id" text NOT NULL,
1349
+ "project_id" text NOT NULL,
1350
+ "decision_id" text NOT NULL,
1351
+ "human_approval_state" text,
1352
+ "execution_readiness" text DEFAULT 'draft' NOT NULL,
1353
+ "planning_inputs_status" text DEFAULT 'requested' NOT NULL,
1354
+ "scope_hash" text NOT NULL,
1355
+ "stale_reason" text,
1356
+ "ready_at" text,
1357
+ "stale_at" text,
1358
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1359
+ "created_at" text NOT NULL,
1360
+ "updated_at" text NOT NULL
1361
+ );
1362
+
1363
+ CREATE TABLE "device_codes" (
448
1364
  "id" text PRIMARY KEY NOT NULL,
449
1365
  "device_code" text NOT NULL,
450
1366
  "user_code" text NOT NULL,
@@ -459,7 +1375,7 @@ CREATE TABLE IF NOT EXISTS "device_codes" (
459
1375
  CONSTRAINT "device_codes_user_code_unique" UNIQUE("user_code")
460
1376
  );
461
1377
 
462
- CREATE TABLE IF NOT EXISTS "entitlements" (
1378
+ CREATE TABLE "entitlements" (
463
1379
  "id" text PRIMARY KEY NOT NULL,
464
1380
  "team_id" text,
465
1381
  "project_id" text,
@@ -470,7 +1386,7 @@ CREATE TABLE IF NOT EXISTS "entitlements" (
470
1386
  "updated_at" text NOT NULL
471
1387
  );
472
1388
 
473
- CREATE TABLE IF NOT EXISTS "execution_provider_native_limits" (
1389
+ CREATE TABLE "execution_provider_native_limits" (
474
1390
  "id" text PRIMARY KEY NOT NULL,
475
1391
  "execution_provider_id" text NOT NULL,
476
1392
  "scope" text NOT NULL,
@@ -486,7 +1402,7 @@ CREATE TABLE IF NOT EXISTS "execution_provider_native_limits" (
486
1402
  "updated_at" text NOT NULL
487
1403
  );
488
1404
 
489
- CREATE TABLE IF NOT EXISTS "execution_provider_observations" (
1405
+ CREATE TABLE "execution_provider_observations" (
490
1406
  "id" text PRIMARY KEY NOT NULL,
491
1407
  "execution_provider_id" text NOT NULL,
492
1408
  "observed_at" text NOT NULL,
@@ -501,24 +1417,86 @@ CREATE TABLE IF NOT EXISTS "execution_provider_observations" (
501
1417
  "created_at" text NOT NULL
502
1418
  );
503
1419
 
504
- CREATE TABLE IF NOT EXISTS "execution_providers" (
1420
+ CREATE TABLE "execution_providers" (
1421
+ "id" text PRIMARY KEY NOT NULL,
1422
+ "team_id" text NOT NULL,
1423
+ "capacity_provider_id" text,
1424
+ "name" text NOT NULL,
1425
+ "kind" text NOT NULL,
1426
+ "status" text DEFAULT 'active' NOT NULL,
1427
+ "native_unit" text NOT NULL,
1428
+ "quota_visibility" text DEFAULT 'opaque' NOT NULL,
1429
+ "max_concurrent_workers" integer DEFAULT 1 NOT NULL,
1430
+ "reset_cadence" text,
1431
+ "config_json" text DEFAULT '{}' NOT NULL,
1432
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1433
+ "created_at" text NOT NULL,
1434
+ "updated_at" text NOT NULL
1435
+ );
1436
+
1437
+ CREATE TABLE "github_app_installation_records" (
1438
+ "id" text PRIMARY KEY NOT NULL,
1439
+ "team_id" text NOT NULL,
1440
+ "installation_id" text NOT NULL,
1441
+ "account_login" text,
1442
+ "account_id" text,
1443
+ "account_type" text,
1444
+ "status" text DEFAULT 'active' NOT NULL,
1445
+ "permissions_json" text DEFAULT '{}' NOT NULL,
1446
+ "repository_selection" text,
1447
+ "drift_code" text,
1448
+ "observed_at" text,
1449
+ "revoked_at" text,
1450
+ "suspended_at" text,
1451
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1452
+ "created_at" text NOT NULL,
1453
+ "updated_at" text NOT NULL
1454
+ );
1455
+
1456
+ CREATE TABLE "github_app_token_issuance_records" (
1457
+ "id" text PRIMARY KEY NOT NULL,
1458
+ "team_id" text NOT NULL,
1459
+ "project_id" text,
1460
+ "assignment_id" text,
1461
+ "provider_id" text,
1462
+ "workday_id" text,
1463
+ "operation_id" text,
1464
+ "repository" text NOT NULL,
1465
+ "installation_id" text NOT NULL,
1466
+ "status" text DEFAULT 'issued' NOT NULL,
1467
+ "token_prefix" text,
1468
+ "token_hash" text,
1469
+ "permissions_json" text DEFAULT '{}' NOT NULL,
1470
+ "allowed_operations_json" text DEFAULT '[]' NOT NULL,
1471
+ "expires_at" text,
1472
+ "issued_at" text,
1473
+ "revoked_at" text,
1474
+ "fail_closed_code" text,
1475
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1476
+ "created_at" text NOT NULL,
1477
+ "updated_at" text NOT NULL
1478
+ );
1479
+
1480
+ CREATE TABLE "github_repository_grants" (
505
1481
  "id" text PRIMARY KEY NOT NULL,
506
1482
  "team_id" text NOT NULL,
507
- "capacity_provider_id" text,
508
- "name" text NOT NULL,
509
- "kind" text NOT NULL,
1483
+ "project_id" text,
1484
+ "repository" text NOT NULL,
1485
+ "installation_id" text,
1486
+ "account_login" text,
1487
+ "account_id" text,
510
1488
  "status" text DEFAULT 'active' NOT NULL,
511
- "native_unit" text NOT NULL,
512
- "quota_visibility" text DEFAULT 'opaque' NOT NULL,
513
- "max_concurrent_workers" integer DEFAULT 1 NOT NULL,
514
- "reset_cadence" text,
515
- "config_json" text DEFAULT '{}' NOT NULL,
1489
+ "permissions_json" text DEFAULT '{}' NOT NULL,
1490
+ "environments_json" text DEFAULT '[]' NOT NULL,
1491
+ "drift_code" text,
1492
+ "observed_at" text,
1493
+ "revoked_at" text,
516
1494
  "metadata_json" text DEFAULT '{}' NOT NULL,
517
1495
  "created_at" text NOT NULL,
518
1496
  "updated_at" text NOT NULL
519
1497
  );
520
1498
 
521
- CREATE TABLE IF NOT EXISTS "graph_runs" (
1499
+ CREATE TABLE "graph_runs" (
522
1500
  "id" text PRIMARY KEY NOT NULL,
523
1501
  "work_day_id" text NOT NULL,
524
1502
  "corpus_hash" text NOT NULL,
@@ -531,7 +1509,7 @@ CREATE TABLE IF NOT EXISTS "graph_runs" (
531
1509
  "created_at" text NOT NULL
532
1510
  );
533
1511
 
534
- CREATE TABLE IF NOT EXISTS "hub_content_sources" (
1512
+ CREATE TABLE "hub_content_sources" (
535
1513
  "id" text PRIMARY KEY NOT NULL,
536
1514
  "hub_id" text NOT NULL,
537
1515
  "team_id" text NOT NULL,
@@ -549,7 +1527,7 @@ CREATE TABLE IF NOT EXISTS "hub_content_sources" (
549
1527
  CONSTRAINT "hub_content_sources_hub_id_unique" UNIQUE("hub_id")
550
1528
  );
551
1529
 
552
- CREATE TABLE IF NOT EXISTS "hub_launch_events" (
1530
+ CREATE TABLE "hub_launch_events" (
553
1531
  "id" text PRIMARY KEY NOT NULL,
554
1532
  "launch_id" text NOT NULL,
555
1533
  "seq" integer NOT NULL,
@@ -564,7 +1542,7 @@ CREATE TABLE IF NOT EXISTS "hub_launch_events" (
564
1542
  "created_at" text NOT NULL
565
1543
  );
566
1544
 
567
- CREATE TABLE IF NOT EXISTS "hub_launches" (
1545
+ CREATE TABLE "hub_launches" (
568
1546
  "id" text PRIMARY KEY NOT NULL,
569
1547
  "hub_id" text NOT NULL,
570
1548
  "team_id" text NOT NULL,
@@ -581,7 +1559,7 @@ CREATE TABLE IF NOT EXISTS "hub_launches" (
581
1559
  "completed_at" text
582
1560
  );
583
1561
 
584
- CREATE TABLE IF NOT EXISTS "hub_repositories" (
1562
+ CREATE TABLE "hub_repositories" (
585
1563
  "id" text PRIMARY KEY NOT NULL,
586
1564
  "hub_id" text NOT NULL,
587
1565
  "team_id" text NOT NULL,
@@ -603,7 +1581,7 @@ CREATE TABLE IF NOT EXISTS "hub_repositories" (
603
1581
  "updated_at" text NOT NULL
604
1582
  );
605
1583
 
606
- CREATE TABLE IF NOT EXISTS "hub_workspace_links" (
1584
+ CREATE TABLE "hub_workspace_links" (
607
1585
  "id" text PRIMARY KEY NOT NULL,
608
1586
  "hub_id" text NOT NULL,
609
1587
  "team_id" text NOT NULL,
@@ -622,7 +1600,7 @@ CREATE TABLE IF NOT EXISTS "hub_workspace_links" (
622
1600
  "updated_at" text NOT NULL
623
1601
  );
624
1602
 
625
- CREATE TABLE IF NOT EXISTS "knowledge_packs" (
1603
+ CREATE TABLE "knowledge_packs" (
626
1604
  "id" text PRIMARY KEY NOT NULL,
627
1605
  "team_id" text NOT NULL,
628
1606
  "slug" text NOT NULL,
@@ -638,7 +1616,7 @@ CREATE TABLE IF NOT EXISTS "knowledge_packs" (
638
1616
  CONSTRAINT "knowledge_packs_slug_unique" UNIQUE("slug")
639
1617
  );
640
1618
 
641
- CREATE TABLE IF NOT EXISTS "lease_state" (
1619
+ CREATE TABLE "lease_state" (
642
1620
  "model" text,
643
1621
  "item_key" text,
644
1622
  "status" text NOT NULL,
@@ -653,7 +1631,7 @@ CREATE TABLE IF NOT EXISTS "lease_state" (
653
1631
  CONSTRAINT "lease_state_model_item_key_pk" PRIMARY KEY("model","item_key")
654
1632
  );
655
1633
 
656
- CREATE TABLE IF NOT EXISTS "market_auth_credentials" (
1634
+ CREATE TABLE "market_auth_credentials" (
657
1635
  "user_id" text PRIMARY KEY NOT NULL,
658
1636
  "email" text NOT NULL,
659
1637
  "username" text,
@@ -665,7 +1643,7 @@ CREATE TABLE IF NOT EXISTS "market_auth_credentials" (
665
1643
  CONSTRAINT "market_auth_credentials_username_unique" UNIQUE("username")
666
1644
  );
667
1645
 
668
- CREATE TABLE IF NOT EXISTS "market_auth_password_resets" (
1646
+ CREATE TABLE "market_auth_password_resets" (
669
1647
  "id" text PRIMARY KEY NOT NULL,
670
1648
  "user_id" text NOT NULL,
671
1649
  "token_hash" text NOT NULL,
@@ -675,7 +1653,7 @@ CREATE TABLE IF NOT EXISTS "market_auth_password_resets" (
675
1653
  CONSTRAINT "market_auth_password_resets_token_hash_unique" UNIQUE("token_hash")
676
1654
  );
677
1655
 
678
- CREATE TABLE IF NOT EXISTS "market_operation_runners" (
1656
+ CREATE TABLE "market_operation_runners" (
679
1657
  "id" text PRIMARY KEY NOT NULL,
680
1658
  "runner_key" text NOT NULL,
681
1659
  "name" text NOT NULL,
@@ -692,7 +1670,7 @@ CREATE TABLE IF NOT EXISTS "market_operation_runners" (
692
1670
  CONSTRAINT "market_operation_runners_runner_key_unique" UNIQUE("runner_key")
693
1671
  );
694
1672
 
695
- CREATE TABLE IF NOT EXISTS "message_queue" (
1673
+ CREATE TABLE "message_queue" (
696
1674
  "id" serial PRIMARY KEY NOT NULL,
697
1675
  "message_type" text NOT NULL,
698
1676
  "status" text NOT NULL,
@@ -712,7 +1690,7 @@ CREATE TABLE IF NOT EXISTS "message_queue" (
712
1690
  "meta_json" text NOT NULL
713
1691
  );
714
1692
 
715
- CREATE TABLE IF NOT EXISTS "native_usage_observations" (
1693
+ CREATE TABLE "native_usage_observations" (
716
1694
  "id" text PRIMARY KEY NOT NULL,
717
1695
  "task_usage_actual_id" text,
718
1696
  "task_id" text,
@@ -732,7 +1710,7 @@ CREATE TABLE IF NOT EXISTS "native_usage_observations" (
732
1710
  "created_at" text NOT NULL
733
1711
  );
734
1712
 
735
- CREATE TABLE IF NOT EXISTS "permissions" (
1713
+ CREATE TABLE "permissions" (
736
1714
  "id" text PRIMARY KEY NOT NULL,
737
1715
  "key" text NOT NULL,
738
1716
  "resource" text NOT NULL,
@@ -743,7 +1721,24 @@ CREATE TABLE IF NOT EXISTS "permissions" (
743
1721
  CONSTRAINT "permissions_key_unique" UNIQUE("key")
744
1722
  );
745
1723
 
746
- CREATE TABLE IF NOT EXISTS "platform_operation_events" (
1724
+ CREATE TABLE "planning_input_requests" (
1725
+ "id" text PRIMARY KEY NOT NULL,
1726
+ "team_id" text NOT NULL,
1727
+ "project_id" text NOT NULL,
1728
+ "decision_id" text NOT NULL,
1729
+ "project_agent_class_id" text,
1730
+ "mode" text DEFAULT 'planning' NOT NULL,
1731
+ "status" text DEFAULT 'requested' NOT NULL,
1732
+ "scope_hash" text NOT NULL,
1733
+ "prompt" text,
1734
+ "response_json" text DEFAULT '{}' NOT NULL,
1735
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1736
+ "requested_at" text NOT NULL,
1737
+ "completed_at" text,
1738
+ "stale_at" text
1739
+ );
1740
+
1741
+ CREATE TABLE "platform_operation_events" (
747
1742
  "id" text PRIMARY KEY NOT NULL,
748
1743
  "operation_id" text NOT NULL,
749
1744
  "seq" integer NOT NULL,
@@ -752,7 +1747,7 @@ CREATE TABLE IF NOT EXISTS "platform_operation_events" (
752
1747
  "created_at" text NOT NULL
753
1748
  );
754
1749
 
755
- CREATE TABLE IF NOT EXISTS "platform_operations" (
1750
+ CREATE TABLE "platform_operations" (
756
1751
  "id" text PRIMARY KEY NOT NULL,
757
1752
  "namespace" text NOT NULL,
758
1753
  "operation" text NOT NULL,
@@ -773,7 +1768,7 @@ CREATE TABLE IF NOT EXISTS "platform_operations" (
773
1768
  "cancelled_at" text
774
1769
  );
775
1770
 
776
- CREATE TABLE IF NOT EXISTS "platform_repository_claims" (
1771
+ CREATE TABLE "platform_repository_claims" (
777
1772
  "id" text PRIMARY KEY NOT NULL,
778
1773
  "repository_key" text NOT NULL,
779
1774
  "runner_id" text NOT NULL,
@@ -787,7 +1782,7 @@ CREATE TABLE IF NOT EXISTS "platform_repository_claims" (
787
1782
  "updated_at" text NOT NULL
788
1783
  );
789
1784
 
790
- CREATE TABLE IF NOT EXISTS "priority_overrides" (
1785
+ CREATE TABLE "priority_overrides" (
791
1786
  "id" text PRIMARY KEY NOT NULL,
792
1787
  "project_id" text NOT NULL,
793
1788
  "model" text NOT NULL,
@@ -799,7 +1794,7 @@ CREATE TABLE IF NOT EXISTS "priority_overrides" (
799
1794
  "updated_at" text NOT NULL
800
1795
  );
801
1796
 
802
- CREATE TABLE IF NOT EXISTS "priority_snapshots" (
1797
+ CREATE TABLE "priority_snapshots" (
803
1798
  "id" text PRIMARY KEY NOT NULL,
804
1799
  "project_id" text NOT NULL,
805
1800
  "work_day_id" text,
@@ -810,7 +1805,25 @@ CREATE TABLE IF NOT EXISTS "priority_snapshots" (
810
1805
  "updated_at" text NOT NULL
811
1806
  );
812
1807
 
813
- CREATE TABLE IF NOT EXISTS "project_capability_grants" (
1808
+ CREATE TABLE "project_agent_classes" (
1809
+ "id" text PRIMARY KEY NOT NULL,
1810
+ "team_id" text NOT NULL,
1811
+ "project_id" text NOT NULL,
1812
+ "slug" text NOT NULL,
1813
+ "name" text NOT NULL,
1814
+ "status" text DEFAULT 'active' NOT NULL,
1815
+ "allowed_modes_json" text DEFAULT '[]' NOT NULL,
1816
+ "required_capabilities_json" text DEFAULT '[]' NOT NULL,
1817
+ "kernel_profile_json" text DEFAULT '{}' NOT NULL,
1818
+ "kernel_policy_json" text DEFAULT '{}' NOT NULL,
1819
+ "handler_refs_json" text DEFAULT '{}' NOT NULL,
1820
+ "output_contracts_json" text DEFAULT '{}' NOT NULL,
1821
+ "metadata_json" text DEFAULT '{}' NOT NULL,
1822
+ "created_at" text NOT NULL,
1823
+ "updated_at" text NOT NULL
1824
+ );
1825
+
1826
+ CREATE TABLE "project_capability_grants" (
814
1827
  "id" text PRIMARY KEY NOT NULL,
815
1828
  "project_id" text NOT NULL,
816
1829
  "label" text,
@@ -827,7 +1840,7 @@ CREATE TABLE IF NOT EXISTS "project_capability_grants" (
827
1840
  "updated_at" text NOT NULL
828
1841
  );
829
1842
 
830
- CREATE TABLE IF NOT EXISTS "project_connections" (
1843
+ CREATE TABLE "project_connections" (
831
1844
  "id" text PRIMARY KEY NOT NULL,
832
1845
  "project_id" text NOT NULL,
833
1846
  "mode" text NOT NULL,
@@ -844,7 +1857,7 @@ CREATE TABLE IF NOT EXISTS "project_connections" (
844
1857
  CONSTRAINT "project_connections_project_id_unique" UNIQUE("project_id")
845
1858
  );
846
1859
 
847
- CREATE TABLE IF NOT EXISTS "project_deployment_events" (
1860
+ CREATE TABLE "project_deployment_events" (
848
1861
  "id" text PRIMARY KEY NOT NULL,
849
1862
  "deployment_id" text NOT NULL,
850
1863
  "project_id" text NOT NULL,
@@ -859,7 +1872,7 @@ CREATE TABLE IF NOT EXISTS "project_deployment_events" (
859
1872
  "created_at" text NOT NULL
860
1873
  );
861
1874
 
862
- CREATE TABLE IF NOT EXISTS "project_deployments" (
1875
+ CREATE TABLE "project_deployments" (
863
1876
  "id" text PRIMARY KEY NOT NULL,
864
1877
  "team_id" text NOT NULL,
865
1878
  "project_id" text NOT NULL,
@@ -891,7 +1904,7 @@ CREATE TABLE IF NOT EXISTS "project_deployments" (
891
1904
  "completed_at" text
892
1905
  );
893
1906
 
894
- CREATE TABLE IF NOT EXISTS "project_environments" (
1907
+ CREATE TABLE "project_environments" (
895
1908
  "id" text PRIMARY KEY NOT NULL,
896
1909
  "project_id" text NOT NULL,
897
1910
  "environment" text NOT NULL,
@@ -909,7 +1922,7 @@ CREATE TABLE IF NOT EXISTS "project_environments" (
909
1922
  "updated_at" text NOT NULL
910
1923
  );
911
1924
 
912
- CREATE TABLE IF NOT EXISTS "project_hosting" (
1925
+ CREATE TABLE "project_hosting" (
913
1926
  "id" text PRIMARY KEY NOT NULL,
914
1927
  "project_id" text NOT NULL,
915
1928
  "hosting_kind" text NOT NULL,
@@ -925,7 +1938,7 @@ CREATE TABLE IF NOT EXISTS "project_hosting" (
925
1938
  CONSTRAINT "project_hosting_project_id_unique" UNIQUE("project_id")
926
1939
  );
927
1940
 
928
- CREATE TABLE IF NOT EXISTS "project_infrastructure_resources" (
1941
+ CREATE TABLE "project_infrastructure_resources" (
929
1942
  "id" text PRIMARY KEY NOT NULL,
930
1943
  "project_id" text NOT NULL,
931
1944
  "environment" text NOT NULL,
@@ -938,7 +1951,7 @@ CREATE TABLE IF NOT EXISTS "project_infrastructure_resources" (
938
1951
  "updated_at" text NOT NULL
939
1952
  );
940
1953
 
941
- CREATE TABLE IF NOT EXISTS "project_summary_snapshots" (
1954
+ CREATE TABLE "project_summary_snapshots" (
942
1955
  "project_id" text PRIMARY KEY NOT NULL,
943
1956
  "team_id" text NOT NULL,
944
1957
  "summary_json" text NOT NULL,
@@ -947,7 +1960,7 @@ CREATE TABLE IF NOT EXISTS "project_summary_snapshots" (
947
1960
  "updated_at" text NOT NULL
948
1961
  );
949
1962
 
950
- CREATE TABLE IF NOT EXISTS "project_update_plans" (
1963
+ CREATE TABLE "project_update_plans" (
951
1964
  "id" text PRIMARY KEY NOT NULL,
952
1965
  "hub_id" text NOT NULL,
953
1966
  "team_id" text NOT NULL,
@@ -963,7 +1976,7 @@ CREATE TABLE IF NOT EXISTS "project_update_plans" (
963
1976
  "updated_at" text NOT NULL
964
1977
  );
965
1978
 
966
- CREATE TABLE IF NOT EXISTS "project_workday_summaries" (
1979
+ CREATE TABLE "project_workday_summaries" (
967
1980
  "id" text PRIMARY KEY NOT NULL,
968
1981
  "project_id" text NOT NULL,
969
1982
  "environment" text NOT NULL,
@@ -978,7 +1991,7 @@ CREATE TABLE IF NOT EXISTS "project_workday_summaries" (
978
1991
  "updated_at" text NOT NULL
979
1992
  );
980
1993
 
981
- CREATE TABLE IF NOT EXISTS "projects" (
1994
+ CREATE TABLE "projects" (
982
1995
  "id" text PRIMARY KEY NOT NULL,
983
1996
  "team_id" text NOT NULL,
984
1997
  "slug" text NOT NULL,
@@ -989,7 +2002,75 @@ CREATE TABLE IF NOT EXISTS "projects" (
989
2002
  "updated_at" text NOT NULL
990
2003
  );
991
2004
 
992
- CREATE TABLE IF NOT EXISTS "provider_credential_sessions" (
2005
+ CREATE TABLE "provider_assignments" (
2006
+ "id" text PRIMARY KEY NOT NULL,
2007
+ "team_id" text NOT NULL,
2008
+ "project_id" text NOT NULL,
2009
+ "capacity_provider_id" text NOT NULL,
2010
+ "provider_session_id" text,
2011
+ "execution_provider_id" text,
2012
+ "allocation_set_id" text,
2013
+ "project_agent_class_id" text NOT NULL,
2014
+ "reservation_id" text,
2015
+ "work_day_id" text,
2016
+ "task_id" text,
2017
+ "mode" text NOT NULL,
2018
+ "status" text DEFAULT 'pending' NOT NULL,
2019
+ "lease_state" text DEFAULT 'unleased' NOT NULL,
2020
+ "lease_expires_at" text,
2021
+ "lease_token" text,
2022
+ "lease_renewed_at" text,
2023
+ "runner_id" text,
2024
+ "agent_id" text,
2025
+ "handler_id" text,
2026
+ "capacity_envelope_json" text DEFAULT '{}' NOT NULL,
2027
+ "decision_input_json" text DEFAULT '{}' NOT NULL,
2028
+ "workspace_context_json" text DEFAULT '{}' NOT NULL,
2029
+ "allowed_outputs_json" text DEFAULT '{}' NOT NULL,
2030
+ "explanation_json" text DEFAULT '{}' NOT NULL,
2031
+ "attempt_count" integer DEFAULT 0 NOT NULL,
2032
+ "assigned_at" text,
2033
+ "claimed_at" text,
2034
+ "completed_at" text,
2035
+ "returned_at" text,
2036
+ "failed_at" text,
2037
+ "lifecycle_reason" text,
2038
+ "lifecycle_code" text,
2039
+ "lifecycle_output_json" text DEFAULT '{}' NOT NULL,
2040
+ "synthesized_from" text,
2041
+ "synthesis_key" text,
2042
+ "decision_id" text,
2043
+ "proposal_id" text,
2044
+ "fallback_output_id" text,
2045
+ "treedx_proxy_handle_json" text DEFAULT '{}' NOT NULL,
2046
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2047
+ "created_at" text NOT NULL,
2048
+ "updated_at" text NOT NULL
2049
+ );
2050
+
2051
+ CREATE TABLE "provider_availability_sessions" (
2052
+ "id" text PRIMARY KEY NOT NULL,
2053
+ "team_id" text NOT NULL,
2054
+ "capacity_provider_id" text NOT NULL,
2055
+ "registration_id" text,
2056
+ "environment" text,
2057
+ "status" text DEFAULT 'open' NOT NULL,
2058
+ "checked_in_at" text NOT NULL,
2059
+ "available_from" text,
2060
+ "available_until" text,
2061
+ "execution_providers_json" text DEFAULT '[]' NOT NULL,
2062
+ "capabilities_json" text DEFAULT '[]' NOT NULL,
2063
+ "grants_json" text DEFAULT '[]' NOT NULL,
2064
+ "native_limits_json" text DEFAULT '{}' NOT NULL,
2065
+ "runner_pressure_json" text DEFAULT '{}' NOT NULL,
2066
+ "constraints_json" text DEFAULT '{}' NOT NULL,
2067
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2068
+ "created_at" text NOT NULL,
2069
+ "updated_at" text NOT NULL,
2070
+ "closed_at" text
2071
+ );
2072
+
2073
+ CREATE TABLE "provider_credential_sessions" (
993
2074
  "id" text PRIMARY KEY NOT NULL,
994
2075
  "team_id" text NOT NULL,
995
2076
  "project_id" text,
@@ -1007,7 +2088,7 @@ CREATE TABLE IF NOT EXISTS "provider_credential_sessions" (
1007
2088
  "metadata_json" text DEFAULT '{}' NOT NULL
1008
2089
  );
1009
2090
 
1010
- CREATE TABLE IF NOT EXISTS "remote_job_events" (
2091
+ CREATE TABLE "remote_job_events" (
1011
2092
  "id" text PRIMARY KEY NOT NULL,
1012
2093
  "job_id" text NOT NULL,
1013
2094
  "seq" integer NOT NULL,
@@ -1016,7 +2097,7 @@ CREATE TABLE IF NOT EXISTS "remote_job_events" (
1016
2097
  "created_at" text NOT NULL
1017
2098
  );
1018
2099
 
1019
- CREATE TABLE IF NOT EXISTS "remote_jobs" (
2100
+ CREATE TABLE "remote_jobs" (
1020
2101
  "id" text PRIMARY KEY NOT NULL,
1021
2102
  "project_id" text NOT NULL,
1022
2103
  "namespace" text NOT NULL,
@@ -1039,7 +2120,7 @@ CREATE TABLE IF NOT EXISTS "remote_jobs" (
1039
2120
  "cancelled_at" text
1040
2121
  );
1041
2122
 
1042
- CREATE TABLE IF NOT EXISTS "reports" (
2123
+ CREATE TABLE "reports" (
1043
2124
  "id" text PRIMARY KEY NOT NULL,
1044
2125
  "work_day_id" text NOT NULL,
1045
2126
  "kind" text NOT NULL,
@@ -1049,7 +2130,7 @@ CREATE TABLE IF NOT EXISTS "reports" (
1049
2130
  "created_at" text NOT NULL
1050
2131
  );
1051
2132
 
1052
- CREATE TABLE IF NOT EXISTS "repository_claims" (
2133
+ CREATE TABLE "repository_claims" (
1053
2134
  "id" text PRIMARY KEY NOT NULL,
1054
2135
  "project_id" text NOT NULL,
1055
2136
  "repository_id" text NOT NULL,
@@ -1064,7 +2145,7 @@ CREATE TABLE IF NOT EXISTS "repository_claims" (
1064
2145
  "updated_at" text NOT NULL
1065
2146
  );
1066
2147
 
1067
- CREATE TABLE IF NOT EXISTS "repository_hosts" (
2148
+ CREATE TABLE "repository_hosts" (
1068
2149
  "id" text PRIMARY KEY NOT NULL,
1069
2150
  "team_id" text,
1070
2151
  "provider" text NOT NULL,
@@ -1087,14 +2168,14 @@ CREATE TABLE IF NOT EXISTS "repository_hosts" (
1087
2168
  "updated_at" text NOT NULL
1088
2169
  );
1089
2170
 
1090
- CREATE TABLE IF NOT EXISTS "role_permissions" (
2171
+ CREATE TABLE "role_permissions" (
1091
2172
  "role_id" text,
1092
2173
  "permission_id" text,
1093
2174
  "created_at" text NOT NULL,
1094
2175
  CONSTRAINT "role_permissions_role_id_permission_id_pk" PRIMARY KEY("role_id","permission_id")
1095
2176
  );
1096
2177
 
1097
- CREATE TABLE IF NOT EXISTS "roles" (
2178
+ CREATE TABLE "roles" (
1098
2179
  "id" text PRIMARY KEY NOT NULL,
1099
2180
  "key" text NOT NULL,
1100
2181
  "description" text,
@@ -1102,7 +2183,7 @@ CREATE TABLE IF NOT EXISTS "roles" (
1102
2183
  CONSTRAINT "roles_key_unique" UNIQUE("key")
1103
2184
  );
1104
2185
 
1105
- CREATE TABLE IF NOT EXISTS "runner_scale_decisions" (
2186
+ CREATE TABLE "runner_scale_decisions" (
1106
2187
  "id" text PRIMARY KEY NOT NULL,
1107
2188
  "project_id" text NOT NULL,
1108
2189
  "environment" text NOT NULL,
@@ -1115,14 +2196,14 @@ CREATE TABLE IF NOT EXISTS "runner_scale_decisions" (
1115
2196
  "created_at" text NOT NULL
1116
2197
  );
1117
2198
 
1118
- CREATE TABLE IF NOT EXISTS "runtime_envelopes" (
2199
+ CREATE TABLE "runtime_envelopes" (
1119
2200
  "id" serial PRIMARY KEY NOT NULL,
1120
2201
  "record_type" text NOT NULL,
1121
2202
  "payload_json" text NOT NULL,
1122
2203
  "created_at" text NOT NULL
1123
2204
  );
1124
2205
 
1125
- CREATE TABLE IF NOT EXISTS "runtime_records" (
2206
+ CREATE TABLE "runtime_records" (
1126
2207
  "id" serial PRIMARY KEY NOT NULL,
1127
2208
  "record_type" text NOT NULL,
1128
2209
  "record_key" text NOT NULL,
@@ -1136,7 +2217,45 @@ CREATE TABLE IF NOT EXISTS "runtime_records" (
1136
2217
  "meta_json" text NOT NULL
1137
2218
  );
1138
2219
 
1139
- CREATE TABLE IF NOT EXISTS "scale_decisions" (
2220
+ CREATE TABLE "runtime_task_events" (
2221
+ "id" text PRIMARY KEY NOT NULL,
2222
+ "task_id" text NOT NULL,
2223
+ "kind" text NOT NULL,
2224
+ "data_json" text NOT NULL,
2225
+ "actor" text,
2226
+ "created_at" text NOT NULL
2227
+ );
2228
+
2229
+ CREATE TABLE "runtime_task_outputs" (
2230
+ "id" text PRIMARY KEY NOT NULL,
2231
+ "task_id" text NOT NULL,
2232
+ "output_json" text NOT NULL,
2233
+ "output_ref" text,
2234
+ "summary_json" text,
2235
+ "actor" text,
2236
+ "created_at" text NOT NULL,
2237
+ "updated_at" text NOT NULL
2238
+ );
2239
+
2240
+ CREATE TABLE "runtime_tasks" (
2241
+ "id" text PRIMARY KEY NOT NULL,
2242
+ "project_id" text NOT NULL,
2243
+ "work_day_id" text NOT NULL,
2244
+ "agent_id" text NOT NULL,
2245
+ "type" text NOT NULL,
2246
+ "idempotency_key" text NOT NULL,
2247
+ "payload_json" text NOT NULL,
2248
+ "state" text NOT NULL,
2249
+ "claimed_by" text,
2250
+ "claimed_at" text,
2251
+ "lease_expires_at" text,
2252
+ "attempts" integer DEFAULT 0 NOT NULL,
2253
+ "created_at" text NOT NULL,
2254
+ "updated_at" text NOT NULL,
2255
+ CONSTRAINT "runtime_tasks_idempotency_key_unique" UNIQUE("idempotency_key")
2256
+ );
2257
+
2258
+ CREATE TABLE "scale_decisions" (
1140
2259
  "id" text PRIMARY KEY NOT NULL,
1141
2260
  "project_id" text NOT NULL,
1142
2261
  "environment" text NOT NULL,
@@ -1150,7 +2269,27 @@ CREATE TABLE IF NOT EXISTS "scale_decisions" (
1150
2269
  "created_at" text NOT NULL
1151
2270
  );
1152
2271
 
1153
- CREATE TABLE IF NOT EXISTS "seed_runs" (
2272
+ CREATE TABLE "secret_metadata_records" (
2273
+ "id" text PRIMARY KEY NOT NULL,
2274
+ "team_id" text NOT NULL,
2275
+ "project_id" text,
2276
+ "name" text NOT NULL,
2277
+ "secret_class" text NOT NULL,
2278
+ "custody_mode" text NOT NULL,
2279
+ "owner_kind" text NOT NULL,
2280
+ "status" text DEFAULT 'active' NOT NULL,
2281
+ "github_secret_target_json" text DEFAULT '{}' NOT NULL,
2282
+ "escrow_record_id" text,
2283
+ "api_decryptable" integer DEFAULT 0 NOT NULL,
2284
+ "plaintext_allowed" integer DEFAULT 0 NOT NULL,
2285
+ "fail_closed_code" text,
2286
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2287
+ "created_at" text NOT NULL,
2288
+ "updated_at" text NOT NULL,
2289
+ "tombstoned_at" text
2290
+ );
2291
+
2292
+ CREATE TABLE "seed_runs" (
1154
2293
  "id" text PRIMARY KEY NOT NULL,
1155
2294
  "seed_name" text NOT NULL,
1156
2295
  "seed_version" integer NOT NULL,
@@ -1168,7 +2307,7 @@ CREATE TABLE IF NOT EXISTS "seed_runs" (
1168
2307
  "completed_at" text
1169
2308
  );
1170
2309
 
1171
- CREATE TABLE IF NOT EXISTS "service_credentials" (
2310
+ CREATE TABLE "service_credentials" (
1172
2311
  "id" text PRIMARY KEY NOT NULL,
1173
2312
  "service_id" text NOT NULL,
1174
2313
  "name" text NOT NULL,
@@ -1182,12 +2321,12 @@ CREATE TABLE IF NOT EXISTS "service_credentials" (
1182
2321
  CONSTRAINT "service_credentials_service_id_unique" UNIQUE("service_id")
1183
2322
  );
1184
2323
 
1185
- CREATE TABLE IF NOT EXISTS "subscribers" (
2324
+ CREATE TABLE "subscribers" (
1186
2325
  "email" text PRIMARY KEY NOT NULL,
1187
2326
  "created_at" text NOT NULL
1188
2327
  );
1189
2328
 
1190
- CREATE TABLE IF NOT EXISTS "task_credit_ledger" (
2329
+ CREATE TABLE "task_credit_ledger" (
1191
2330
  "id" text PRIMARY KEY NOT NULL,
1192
2331
  "project_id" text NOT NULL,
1193
2332
  "work_day_id" text NOT NULL,
@@ -1198,7 +2337,7 @@ CREATE TABLE IF NOT EXISTS "task_credit_ledger" (
1198
2337
  "created_at" text NOT NULL
1199
2338
  );
1200
2339
 
1201
- CREATE TABLE IF NOT EXISTS "task_estimate_profiles" (
2340
+ CREATE TABLE "task_estimate_profiles" (
1202
2341
  "task_signature" text,
1203
2342
  "execution_profile_id" text DEFAULT 'standard-code-model',
1204
2343
  "sample_count" integer DEFAULT 0 NOT NULL,
@@ -1224,7 +2363,7 @@ CREATE TABLE IF NOT EXISTS "task_estimate_profiles" (
1224
2363
  CONSTRAINT "task_estimate_profiles_task_signature_execution_profile_id_pk" PRIMARY KEY("task_signature","execution_profile_id")
1225
2364
  );
1226
2365
 
1227
- CREATE TABLE IF NOT EXISTS "task_estimates" (
2366
+ CREATE TABLE "task_estimates" (
1228
2367
  "id" text PRIMARY KEY NOT NULL,
1229
2368
  "task_id" text,
1230
2369
  "work_day_id" text,
@@ -1246,29 +2385,15 @@ CREATE TABLE IF NOT EXISTS "task_estimates" (
1246
2385
  "execution_profile_id" text DEFAULT 'standard-code-model' NOT NULL
1247
2386
  );
1248
2387
 
1249
- CREATE TABLE IF NOT EXISTS "task_events" (
1250
- "id" text PRIMARY KEY NOT NULL,
1251
- "task_id" text NOT NULL,
1252
- "seq" integer NOT NULL,
1253
- "kind" text NOT NULL,
1254
- "data_json" text NOT NULL,
1255
- "created_at" text NOT NULL
1256
- );
1257
-
1258
- CREATE TABLE IF NOT EXISTS "task_outputs" (
1259
- "id" text PRIMARY KEY NOT NULL,
1260
- "task_id" text NOT NULL,
1261
- "output_json" text NOT NULL,
1262
- "output_ref" text,
1263
- "created_at" text NOT NULL
1264
- );
1265
-
1266
- CREATE TABLE IF NOT EXISTS "task_usage_actuals" (
2388
+ CREATE TABLE "task_usage_actuals" (
1267
2389
  "id" text PRIMARY KEY NOT NULL,
1268
2390
  "task_id" text,
1269
2391
  "work_day_id" text,
1270
2392
  "project_id" text NOT NULL,
1271
2393
  "task_signature" text NOT NULL,
2394
+ "assignment_id" text,
2395
+ "mode_run_id" text,
2396
+ "mode" text,
1272
2397
  "capacity_provider_id" text,
1273
2398
  "execution_provider_id" text,
1274
2399
  "lane_id" text,
@@ -1295,33 +2420,7 @@ CREATE TABLE IF NOT EXISTS "task_usage_actuals" (
1295
2420
  "execution_profile_id" text DEFAULT 'standard-code-model' NOT NULL
1296
2421
  );
1297
2422
 
1298
- CREATE TABLE IF NOT EXISTS "tasks" (
1299
- "id" text PRIMARY KEY NOT NULL,
1300
- "work_day_id" text NOT NULL,
1301
- "agent_id" text NOT NULL,
1302
- "type" text NOT NULL,
1303
- "state" text NOT NULL,
1304
- "priority" integer DEFAULT 0 NOT NULL,
1305
- "idempotency_key" text NOT NULL,
1306
- "payload_json" text NOT NULL,
1307
- "payload_hash" text,
1308
- "attempt_count" integer DEFAULT 0 NOT NULL,
1309
- "max_attempts" integer DEFAULT 3 NOT NULL,
1310
- "claimed_by" text,
1311
- "lease_expires_at" text,
1312
- "available_at" text NOT NULL,
1313
- "last_error_code" text,
1314
- "last_error_message" text,
1315
- "graph_version" text,
1316
- "parent_task_id" text,
1317
- "created_at" text NOT NULL,
1318
- "started_at" text,
1319
- "completed_at" text,
1320
- "updated_at" text NOT NULL,
1321
- CONSTRAINT "tasks_idempotency_key_unique" UNIQUE("idempotency_key")
1322
- );
1323
-
1324
- CREATE TABLE IF NOT EXISTS "team_api_keys" (
2423
+ CREATE TABLE "team_api_keys" (
1325
2424
  "id" text PRIMARY KEY NOT NULL,
1326
2425
  "team_id" text NOT NULL,
1327
2426
  "name" text NOT NULL,
@@ -1335,7 +2434,7 @@ CREATE TABLE IF NOT EXISTS "team_api_keys" (
1335
2434
  "updated_at" text NOT NULL
1336
2435
  );
1337
2436
 
1338
- CREATE TABLE IF NOT EXISTS "team_inbox_items" (
2437
+ CREATE TABLE "team_inbox_items" (
1339
2438
  "id" text PRIMARY KEY NOT NULL,
1340
2439
  "team_id" text NOT NULL,
1341
2440
  "project_id" text,
@@ -1350,7 +2449,7 @@ CREATE TABLE IF NOT EXISTS "team_inbox_items" (
1350
2449
  "updated_at" text NOT NULL
1351
2450
  );
1352
2451
 
1353
- CREATE TABLE IF NOT EXISTS "team_invites" (
2452
+ CREATE TABLE "team_invites" (
1354
2453
  "id" text PRIMARY KEY NOT NULL,
1355
2454
  "team_id" text NOT NULL,
1356
2455
  "email" text NOT NULL,
@@ -1366,7 +2465,7 @@ CREATE TABLE IF NOT EXISTS "team_invites" (
1366
2465
  "updated_at" text NOT NULL
1367
2466
  );
1368
2467
 
1369
- CREATE TABLE IF NOT EXISTS "team_memberships" (
2468
+ CREATE TABLE "team_memberships" (
1370
2469
  "id" text PRIMARY KEY NOT NULL,
1371
2470
  "team_id" text NOT NULL,
1372
2471
  "user_id" text NOT NULL,
@@ -1375,14 +2474,14 @@ CREATE TABLE IF NOT EXISTS "team_memberships" (
1375
2474
  "updated_at" text NOT NULL
1376
2475
  );
1377
2476
 
1378
- CREATE TABLE IF NOT EXISTS "team_role_bindings" (
2477
+ CREATE TABLE "team_role_bindings" (
1379
2478
  "id" text PRIMARY KEY NOT NULL,
1380
2479
  "team_membership_id" text NOT NULL,
1381
2480
  "role_id" text NOT NULL,
1382
2481
  "created_at" text NOT NULL
1383
2482
  );
1384
2483
 
1385
- CREATE TABLE IF NOT EXISTS "team_storage_locators" (
2484
+ CREATE TABLE "team_storage_locators" (
1386
2485
  "id" text PRIMARY KEY NOT NULL,
1387
2486
  "team_id" text NOT NULL,
1388
2487
  "bucket_name" text NOT NULL,
@@ -1395,7 +2494,7 @@ CREATE TABLE IF NOT EXISTS "team_storage_locators" (
1395
2494
  CONSTRAINT "team_storage_locators_team_id_unique" UNIQUE("team_id")
1396
2495
  );
1397
2496
 
1398
- CREATE TABLE IF NOT EXISTS "team_web_hosts" (
2497
+ CREATE TABLE "team_web_hosts" (
1399
2498
  "id" text PRIMARY KEY NOT NULL,
1400
2499
  "team_id" text NOT NULL,
1401
2500
  "provider" text NOT NULL,
@@ -1412,7 +2511,7 @@ CREATE TABLE IF NOT EXISTS "team_web_hosts" (
1412
2511
  "updated_at" text NOT NULL
1413
2512
  );
1414
2513
 
1415
- CREATE TABLE IF NOT EXISTS "teams" (
2514
+ CREATE TABLE "teams" (
1416
2515
  "id" text PRIMARY KEY NOT NULL,
1417
2516
  "slug" text NOT NULL,
1418
2517
  "name" text NOT NULL,
@@ -1425,7 +2524,157 @@ CREATE TABLE IF NOT EXISTS "teams" (
1425
2524
  CONSTRAINT "teams_slug_unique" UNIQUE("slug")
1426
2525
  );
1427
2526
 
1428
- CREATE TABLE IF NOT EXISTS "user_email_addresses" (
2527
+ CREATE TABLE "treedx_credential_issuance_records" (
2528
+ "id" text PRIMARY KEY NOT NULL,
2529
+ "team_id" text NOT NULL,
2530
+ "project_id" text NOT NULL,
2531
+ "assignment_id" text,
2532
+ "repository" text,
2533
+ "credential_provider" text NOT NULL,
2534
+ "status" text DEFAULT 'issued' NOT NULL,
2535
+ "token_prefix" text,
2536
+ "token_hash" text,
2537
+ "scopes_json" text DEFAULT '[]' NOT NULL,
2538
+ "allowed_operations_json" text DEFAULT '[]' NOT NULL,
2539
+ "expires_at" text,
2540
+ "issued_at" text,
2541
+ "revoked_at" text,
2542
+ "fail_closed_code" text,
2543
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2544
+ "created_at" text NOT NULL,
2545
+ "updated_at" text NOT NULL
2546
+ );
2547
+
2548
+ CREATE TABLE "treedx_deployments" (
2549
+ "id" text PRIMARY KEY NOT NULL,
2550
+ "team_id" text NOT NULL,
2551
+ "instance_id" text,
2552
+ "provider" text NOT NULL,
2553
+ "status" text DEFAULT 'queued' NOT NULL,
2554
+ "image_ref" text,
2555
+ "volume_mount_path" text,
2556
+ "service_refs_json" text DEFAULT '{}' NOT NULL,
2557
+ "result_json" text DEFAULT '{}' NOT NULL,
2558
+ "error_json" text,
2559
+ "created_at" text NOT NULL,
2560
+ "updated_at" text NOT NULL,
2561
+ "completed_at" text
2562
+ );
2563
+
2564
+ CREATE TABLE "treedx_instances" (
2565
+ "id" text PRIMARY KEY NOT NULL,
2566
+ "team_id" text NOT NULL,
2567
+ "kind" text NOT NULL,
2568
+ "provider" text NOT NULL,
2569
+ "name" text NOT NULL,
2570
+ "base_url" text,
2571
+ "registry_url" text,
2572
+ "public_read" integer DEFAULT 0 NOT NULL,
2573
+ "primary" integer DEFAULT 1 NOT NULL,
2574
+ "status" text DEFAULT 'pending' NOT NULL,
2575
+ "image_ref" text,
2576
+ "railway_project_id" text,
2577
+ "railway_service_id" text,
2578
+ "railway_environment_id" text,
2579
+ "volume_mount_path" text,
2580
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2581
+ "created_at" text NOT NULL,
2582
+ "updated_at" text NOT NULL
2583
+ );
2584
+
2585
+ CREATE TABLE "treedx_mirrors" (
2586
+ "id" text PRIMARY KEY NOT NULL,
2587
+ "team_id" text NOT NULL,
2588
+ "instance_id" text NOT NULL,
2589
+ "name" text NOT NULL,
2590
+ "direction" text DEFAULT 'bidirectional' NOT NULL,
2591
+ "target_kind" text NOT NULL,
2592
+ "target_url" text,
2593
+ "status" text DEFAULT 'pending' NOT NULL,
2594
+ "instructions" text,
2595
+ "last_sync_at" text,
2596
+ "last_sync_status" text,
2597
+ "last_sync_metadata_json" text DEFAULT '{}' NOT NULL,
2598
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2599
+ "created_at" text NOT NULL,
2600
+ "updated_at" text NOT NULL
2601
+ );
2602
+
2603
+ CREATE TABLE "treedx_project_libraries" (
2604
+ "id" text PRIMARY KEY NOT NULL,
2605
+ "team_id" text NOT NULL,
2606
+ "project_id" text NOT NULL,
2607
+ "instance_id" text NOT NULL,
2608
+ "library_id" text NOT NULL,
2609
+ "repository_id" text,
2610
+ "content_path" text DEFAULT 'src/content' NOT NULL,
2611
+ "content_repository_url" text,
2612
+ "content_repository_default_branch" text,
2613
+ "content_repository_ref" text,
2614
+ "r2_bucket_name" text,
2615
+ "r2_manifest_key" text,
2616
+ "topology_json" text DEFAULT '{}' NOT NULL,
2617
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2618
+ "created_at" text NOT NULL,
2619
+ "updated_at" text NOT NULL
2620
+ );
2621
+
2622
+ CREATE TABLE "treedx_project_proxy_audit" (
2623
+ "id" text PRIMARY KEY NOT NULL,
2624
+ "team_id" text NOT NULL,
2625
+ "project_id" text NOT NULL,
2626
+ "assignment_id" text,
2627
+ "actor_type" text NOT NULL,
2628
+ "actor_id" text,
2629
+ "method" text NOT NULL,
2630
+ "path" text NOT NULL,
2631
+ "handle_json" text DEFAULT '{}' NOT NULL,
2632
+ "result_status" text DEFAULT 'observed' NOT NULL,
2633
+ "reason_code" text,
2634
+ "reason" text,
2635
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2636
+ "created_at" text NOT NULL
2637
+ );
2638
+
2639
+ CREATE TABLE "treedx_proxy_handles" (
2640
+ "id" text PRIMARY KEY NOT NULL,
2641
+ "team_id" text NOT NULL,
2642
+ "project_id" text NOT NULL,
2643
+ "assignment_id" text,
2644
+ "repository_id" text,
2645
+ "workspace_id" text,
2646
+ "status" text DEFAULT 'issued' NOT NULL,
2647
+ "scopes_json" text DEFAULT '[]' NOT NULL,
2648
+ "allowed_operations_json" text DEFAULT '[]' NOT NULL,
2649
+ "allowed_paths_json" text DEFAULT '[]' NOT NULL,
2650
+ "token_hash" text,
2651
+ "expires_at" text,
2652
+ "issued_at" text NOT NULL,
2653
+ "revoked_at" text,
2654
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2655
+ "created_at" text NOT NULL,
2656
+ "updated_at" text NOT NULL
2657
+ );
2658
+
2659
+ CREATE TABLE "treedx_shares" (
2660
+ "id" text PRIMARY KEY NOT NULL,
2661
+ "team_id" text NOT NULL,
2662
+ "instance_id" text,
2663
+ "project_id" text,
2664
+ "library_id" text,
2665
+ "scope" text NOT NULL,
2666
+ "target_team_id" text,
2667
+ "trust_grant_json" text DEFAULT '{}' NOT NULL,
2668
+ "public_read" integer DEFAULT 0 NOT NULL,
2669
+ "status" text DEFAULT 'active' NOT NULL,
2670
+ "expires_at" text,
2671
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2672
+ "created_at" text NOT NULL,
2673
+ "updated_at" text NOT NULL,
2674
+ "revoked_at" text
2675
+ );
2676
+
2677
+ CREATE TABLE "user_email_addresses" (
1429
2678
  "id" text PRIMARY KEY NOT NULL,
1430
2679
  "user_id" text NOT NULL,
1431
2680
  "email" text NOT NULL,
@@ -1439,7 +2688,7 @@ CREATE TABLE IF NOT EXISTS "user_email_addresses" (
1439
2688
  CONSTRAINT "user_email_addresses_normalized_email_unique" UNIQUE("normalized_email")
1440
2689
  );
1441
2690
 
1442
- CREATE TABLE IF NOT EXISTS "user_identities" (
2691
+ CREATE TABLE "user_identities" (
1443
2692
  "id" text PRIMARY KEY NOT NULL,
1444
2693
  "user_id" text NOT NULL,
1445
2694
  "provider" text NOT NULL,
@@ -1451,7 +2700,7 @@ CREATE TABLE IF NOT EXISTS "user_identities" (
1451
2700
  "updated_at" text NOT NULL
1452
2701
  );
1453
2702
 
1454
- CREATE TABLE IF NOT EXISTS "user_preferences" (
2703
+ CREATE TABLE "user_preferences" (
1455
2704
  "user_id" text PRIMARY KEY NOT NULL,
1456
2705
  "color_scheme" text DEFAULT 'fern' NOT NULL,
1457
2706
  "theme_mode" text DEFAULT 'system' NOT NULL,
@@ -1459,14 +2708,14 @@ CREATE TABLE IF NOT EXISTS "user_preferences" (
1459
2708
  "updated_at" text NOT NULL
1460
2709
  );
1461
2710
 
1462
- CREATE TABLE IF NOT EXISTS "user_role_bindings" (
2711
+ CREATE TABLE "user_role_bindings" (
1463
2712
  "id" text PRIMARY KEY NOT NULL,
1464
2713
  "user_id" text NOT NULL,
1465
2714
  "role_id" text NOT NULL,
1466
2715
  "created_at" text NOT NULL
1467
2716
  );
1468
2717
 
1469
- CREATE TABLE IF NOT EXISTS "users" (
2718
+ CREATE TABLE "users" (
1470
2719
  "id" text PRIMARY KEY NOT NULL,
1471
2720
  "email" text,
1472
2721
  "display_name" text,
@@ -1477,7 +2726,7 @@ CREATE TABLE IF NOT EXISTS "users" (
1477
2726
  "username" text
1478
2727
  );
1479
2728
 
1480
- CREATE TABLE IF NOT EXISTS "web_sessions" (
2729
+ CREATE TABLE "web_sessions" (
1481
2730
  "id" text PRIMARY KEY NOT NULL,
1482
2731
  "user_id" text NOT NULL,
1483
2732
  "identity_id" text,
@@ -1498,7 +2747,7 @@ CREATE TABLE IF NOT EXISTS "web_sessions" (
1498
2747
  "updated_at" text NOT NULL
1499
2748
  );
1500
2749
 
1501
- CREATE TABLE IF NOT EXISTS "work_days" (
2750
+ CREATE TABLE "work_days" (
1502
2751
  "id" text PRIMARY KEY NOT NULL,
1503
2752
  "project_id" text NOT NULL,
1504
2753
  "state" text NOT NULL,
@@ -1512,7 +2761,7 @@ CREATE TABLE IF NOT EXISTS "work_days" (
1512
2761
  "updated_at" text NOT NULL
1513
2762
  );
1514
2763
 
1515
- CREATE TABLE IF NOT EXISTS "work_policies" (
2764
+ CREATE TABLE "work_policies" (
1516
2765
  "project_id" text,
1517
2766
  "environment" text,
1518
2767
  "schedule_json" text NOT NULL,
@@ -1534,7 +2783,26 @@ CREATE TABLE IF NOT EXISTS "work_policies" (
1534
2783
  CONSTRAINT "work_policies_project_id_environment_pk" PRIMARY KEY("project_id","environment")
1535
2784
  );
1536
2785
 
1537
- CREATE TABLE IF NOT EXISTS "workday_manager_leases" (
2786
+ CREATE TABLE "workday_capacity_envelopes" (
2787
+ "id" text PRIMARY KEY NOT NULL,
2788
+ "team_id" text NOT NULL,
2789
+ "project_id" text NOT NULL,
2790
+ "allocation_set_id" text,
2791
+ "status" text DEFAULT 'draft' NOT NULL,
2792
+ "started_at" text,
2793
+ "paused_at" text,
2794
+ "completed_at" text,
2795
+ "envelope_json" text DEFAULT '{}' NOT NULL,
2796
+ "mode_splits_json" text DEFAULT '{}' NOT NULL,
2797
+ "caps_json" text DEFAULT '{}' NOT NULL,
2798
+ "reserves_json" text DEFAULT '{}' NOT NULL,
2799
+ "borrowing_rules_json" text DEFAULT '{}' NOT NULL,
2800
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2801
+ "created_at" text NOT NULL,
2802
+ "updated_at" text NOT NULL
2803
+ );
2804
+
2805
+ CREATE TABLE "workday_manager_leases" (
1538
2806
  "id" text PRIMARY KEY NOT NULL,
1539
2807
  "project_id" text NOT NULL,
1540
2808
  "environment" text NOT NULL,
@@ -1548,7 +2816,7 @@ CREATE TABLE IF NOT EXISTS "workday_manager_leases" (
1548
2816
  "updated_at" text NOT NULL
1549
2817
  );
1550
2818
 
1551
- CREATE TABLE IF NOT EXISTS "workday_requests" (
2819
+ CREATE TABLE "workday_requests" (
1552
2820
  "id" text PRIMARY KEY NOT NULL,
1553
2821
  "project_id" text NOT NULL,
1554
2822
  "environment" text NOT NULL,
@@ -1563,7 +2831,7 @@ CREATE TABLE IF NOT EXISTS "workday_requests" (
1563
2831
  "updated_at" text NOT NULL
1564
2832
  );
1565
2833
 
1566
- CREATE TABLE IF NOT EXISTS "worker_runners" (
2834
+ CREATE TABLE "worker_runners" (
1567
2835
  "id" text PRIMARY KEY NOT NULL,
1568
2836
  "project_id" text NOT NULL,
1569
2837
  "environment" text NOT NULL,
@@ -1581,1349 +2849,375 @@ CREATE TABLE IF NOT EXISTS "worker_runners" (
1581
2849
  "updated_at" text NOT NULL
1582
2850
  );
1583
2851
 
1584
- -- Treeseed Market schema adoption columns
1585
- ALTER TABLE "agent_messages" ADD COLUMN IF NOT EXISTS "id" integer;
1586
- ALTER TABLE "agent_messages" ADD COLUMN IF NOT EXISTS "type" text;
1587
- ALTER TABLE "agent_messages" ADD COLUMN IF NOT EXISTS "payload_json" text;
1588
- ALTER TABLE "agent_messages" ADD COLUMN IF NOT EXISTS "created_at" text;
1589
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "id" text;
1590
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "pool_id" text;
1591
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "project_id" text;
1592
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "runner_id" text;
1593
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "manager_id" text;
1594
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "service_name" text;
1595
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "heartbeat_at" text;
1596
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "desired_workers" integer;
1597
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "observed_queue_depth" integer;
1598
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "observed_active_leases" integer;
1599
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1600
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "created_at" text;
1601
- ALTER TABLE "agent_pool_registrations" ADD COLUMN IF NOT EXISTS "updated_at" text;
1602
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "id" text;
1603
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "pool_id" text;
1604
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "project_id" text;
1605
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "environment" text;
1606
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "desired_workers" integer;
1607
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "observed_queue_depth" integer DEFAULT 0;
1608
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "observed_active_leases" integer DEFAULT 0;
1609
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "work_day_id" text;
1610
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "reason" text;
1611
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1612
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "created_at" text;
1613
- ALTER TABLE "agent_pool_scale_decisions" ADD COLUMN IF NOT EXISTS "updated_at" text;
1614
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "id" text;
1615
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "project_id" text;
1616
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "team_id" text;
1617
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "environment" text;
1618
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "name" text;
1619
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "registration_identity" text;
1620
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "service_base_url" text;
1621
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'pending';
1622
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "min_workers" integer DEFAULT 0;
1623
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "max_workers" integer DEFAULT 1;
1624
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "target_queue_depth" integer DEFAULT 1;
1625
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "cooldown_seconds" integer DEFAULT 60;
1626
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1627
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "created_at" text;
1628
- ALTER TABLE "agent_pools" ADD COLUMN IF NOT EXISTS "updated_at" text;
1629
- ALTER TABLE "agent_runs" ADD COLUMN IF NOT EXISTS "run_id" text;
1630
- ALTER TABLE "agent_runs" ADD COLUMN IF NOT EXISTS "agent_slug" text;
1631
- ALTER TABLE "agent_runs" ADD COLUMN IF NOT EXISTS "status" text;
1632
- ALTER TABLE "agent_runs" ADD COLUMN IF NOT EXISTS "created_at" text;
1633
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "id" text;
1634
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "user_id" text;
1635
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "kind" text;
1636
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "name" text;
1637
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "token_prefix" text;
1638
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "token_hash" text;
1639
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "scopes_json" text;
1640
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "expires_at" text;
1641
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "last_used_at" text;
1642
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "revoked_at" text;
1643
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1644
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "created_at" text;
1645
- ALTER TABLE "api_tokens" ADD COLUMN IF NOT EXISTS "updated_at" text;
1646
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "id" text;
1647
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "team_id" text;
1648
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "project_id" text;
1649
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "work_day_id" text;
1650
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "task_id" text;
1651
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "kind" text;
1652
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'pending';
1653
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "severity" text DEFAULT 'medium';
1654
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "requested_by_type" text DEFAULT 'worker';
1655
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "requested_by_id" text;
1656
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "title" text;
1657
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "summary" text;
1658
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "options_json" text DEFAULT '[]';
1659
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "recommendation_json" text DEFAULT '{}';
1660
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "policy_snapshot_json" text DEFAULT '{}';
1661
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "expires_at" text;
1662
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "decided_by_type" text;
1663
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "decided_by_id" text;
1664
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "decided_at" text;
1665
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "decision_json" text;
1666
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1667
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "created_at" text;
1668
- ALTER TABLE "approval_requests" ADD COLUMN IF NOT EXISTS "updated_at" text;
1669
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "id" text;
1670
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "actor_type" text;
1671
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "actor_id" text;
1672
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "event_type" text;
1673
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "target_type" text;
1674
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "target_id" text;
1675
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "data_json" text;
1676
- ALTER TABLE "audit_events" ADD COLUMN IF NOT EXISTS "created_at" text;
1677
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "id" text;
1678
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "user_id" text;
1679
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "session_type" text;
1680
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "refresh_token_hash" text;
1681
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "scopes_json" text;
1682
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "expires_at" text;
1683
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "revoked_at" text;
1684
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "data_json" text;
1685
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "created_at" text;
1686
- ALTER TABLE "auth_sessions" ADD COLUMN IF NOT EXISTS "updated_at" text;
1687
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "id" text;
1688
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "accountId" text;
1689
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "providerId" text;
1690
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "userId" text;
1691
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "accessToken" text;
1692
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "refreshToken" text;
1693
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "idToken" text;
1694
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "accessTokenExpiresAt" integer;
1695
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "refreshTokenExpiresAt" integer;
1696
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "scope" text;
1697
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "password" text;
1698
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "createdAt" integer;
1699
- ALTER TABLE "better_auth_account" ADD COLUMN IF NOT EXISTS "updatedAt" integer;
1700
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "id" text;
1701
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "expiresAt" integer;
1702
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "token" text;
1703
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "createdAt" integer;
1704
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "updatedAt" integer;
1705
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "ipAddress" text;
1706
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "userAgent" text;
1707
- ALTER TABLE "better_auth_session" ADD COLUMN IF NOT EXISTS "userId" text;
1708
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "id" text;
1709
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "name" text;
1710
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "email" text;
1711
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "emailVerified" integer DEFAULT 0;
1712
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "image" text;
1713
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "createdAt" integer;
1714
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "updatedAt" integer;
1715
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "username" text;
1716
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "firstName" text;
1717
- ALTER TABLE "better_auth_user" ADD COLUMN IF NOT EXISTS "lastName" text;
1718
- ALTER TABLE "better_auth_verification" ADD COLUMN IF NOT EXISTS "id" text;
1719
- ALTER TABLE "better_auth_verification" ADD COLUMN IF NOT EXISTS "identifier" text;
1720
- ALTER TABLE "better_auth_verification" ADD COLUMN IF NOT EXISTS "value" text;
1721
- ALTER TABLE "better_auth_verification" ADD COLUMN IF NOT EXISTS "expiresAt" integer;
1722
- ALTER TABLE "better_auth_verification" ADD COLUMN IF NOT EXISTS "createdAt" integer;
1723
- ALTER TABLE "better_auth_verification" ADD COLUMN IF NOT EXISTS "updatedAt" integer;
1724
- ALTER TABLE "better_auth_verification" ALTER COLUMN "expiresAt" TYPE bigint;
1725
- ALTER TABLE "better_auth_verification" ALTER COLUMN "createdAt" TYPE bigint;
1726
- ALTER TABLE "better_auth_verification" ALTER COLUMN "updatedAt" TYPE bigint;
1727
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "id" text;
1728
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1729
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "lane_id" text;
1730
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "grant_scope" text DEFAULT 'team';
1731
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "team_id" text;
1732
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "project_id" text;
1733
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "environment" text;
1734
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'active';
1735
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "daily_credit_limit" real;
1736
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "weekly_credit_limit" real;
1737
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "monthly_credit_limit" real;
1738
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "daily_usd_limit" real;
1739
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "weekly_quota_minutes" real;
1740
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "monthly_provider_units" real;
1741
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "priority_weight" real DEFAULT 1;
1742
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "overflow_policy" text DEFAULT 'soft_grant';
1743
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1744
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "created_at" text;
1745
- ALTER TABLE "capacity_grants" ADD COLUMN IF NOT EXISTS "updated_at" text;
1746
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "id" text;
1747
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1748
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "lane_id" text;
1749
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "reservation_id" text;
1750
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "team_id" text;
1751
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "project_id" text;
1752
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "work_day_id" text;
1753
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "task_id" text;
1754
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "phase" text;
1755
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "credits" real;
1756
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "provider_units" real;
1757
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "usd" real;
1758
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "source" text;
1759
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1760
- ALTER TABLE "capacity_ledger_entries" ADD COLUMN IF NOT EXISTS "created_at" text;
1761
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "id" text;
1762
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1763
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "team_id" text;
1764
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "name" text;
1765
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "key_prefix" text;
1766
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "key_hash" text;
1767
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "scopes_json" text DEFAULT '[]';
1768
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
1769
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "last_used_at" text;
1770
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "rotated_from_key_id" text;
1771
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "expires_at" text;
1772
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "revoked_at" text;
1773
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "created_by_id" text;
1774
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "created_at" text;
1775
- ALTER TABLE "capacity_provider_api_keys" ADD COLUMN IF NOT EXISTS "updated_at" text;
1776
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "id" text;
1777
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "team_id" text;
1778
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1779
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "launch_mode" text;
1780
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "host_kind" text;
1781
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "host_id" text;
1782
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "status" text;
1783
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "image_ref" text;
1784
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "service_refs_json" text DEFAULT '{}';
1785
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "env_refs_json" text DEFAULT '{}';
1786
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "result_json" text DEFAULT '{}';
1787
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "error_json" text;
1788
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "created_by_id" text;
1789
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "created_at" text;
1790
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "updated_at" text;
1791
- ALTER TABLE "capacity_provider_deployments" ADD COLUMN IF NOT EXISTS "completed_at" text;
1792
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "id" text;
1793
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1794
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "host_id" text;
1795
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "role" text;
1796
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "required" integer DEFAULT 1;
1797
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1798
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "created_at" text;
1799
- ALTER TABLE "capacity_provider_hosts" ADD COLUMN IF NOT EXISTS "updated_at" text;
1800
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "id" text;
1801
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1802
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "name" text;
1803
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "business_model" text DEFAULT 'custom';
1804
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "model_family" text;
1805
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "model_class" text;
1806
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "region_policy" text;
1807
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "unit" text DEFAULT 'treeseed_credit';
1808
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "scarcity_level" text DEFAULT 'medium';
1809
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "hard_limits_json" text DEFAULT '{}';
1810
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "routing_policy_json" text DEFAULT '{}';
1811
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1812
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "created_at" text;
1813
- ALTER TABLE "capacity_provider_lanes" ADD COLUMN IF NOT EXISTS "updated_at" text;
1814
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "id" text;
1815
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1816
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "team_id" text;
1817
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "runtime_version" text;
1818
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "market_id" text;
1819
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "capabilities_json" text DEFAULT '[]';
1820
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "budgets_json" text DEFAULT '{}';
1821
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "health_json" text DEFAULT '{}';
1822
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'online';
1823
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "registered_at" text;
1824
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "last_seen_at" text;
1825
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "disconnected_at" text;
1826
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "created_at" text;
1827
- ALTER TABLE "capacity_provider_registrations" ADD COLUMN IF NOT EXISTS "updated_at" text;
1828
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "id" text;
1829
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "team_id" text;
1830
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "owner_team_id" text;
1831
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "name" text;
1832
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "kind" text;
1833
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'pending';
1834
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "provider" text;
1835
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "billing_scope" text DEFAULT 'team';
1836
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "monthly_credit_budget" real DEFAULT 0;
1837
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "daily_credit_budget" real DEFAULT 0;
1838
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "credit_budget_mode" text DEFAULT 'derived';
1839
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "max_concurrent_workdays" integer DEFAULT 1;
1840
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "max_concurrent_workers" integer DEFAULT 1;
1841
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "capacity_model_json" text DEFAULT '{}';
1842
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1843
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "created_at" text;
1844
- ALTER TABLE "capacity_providers" ADD COLUMN IF NOT EXISTS "updated_at" text;
1845
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "id" text;
1846
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1847
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "execution_provider_id" text;
1848
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "lane_id" text;
1849
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "team_id" text;
1850
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "project_id" text;
1851
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "work_day_id" text;
1852
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "task_id" text;
1853
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'reserved';
1854
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "reserved_credits" real;
1855
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "consumed_credits" real DEFAULT 0;
1856
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "native_unit" text;
1857
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "reserved_native_amount" real;
1858
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "consumed_native_amount" real;
1859
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "reserved_provider_units" real;
1860
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "consumed_provider_units" real;
1861
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "reserved_usd" real;
1862
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "consumed_usd" real;
1863
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "expires_at" text;
1864
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1865
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "created_at" text;
1866
- ALTER TABLE "capacity_reservations" ADD COLUMN IF NOT EXISTS "updated_at" text;
1867
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "id" text;
1868
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "task_id" text;
1869
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "work_day_id" text;
1870
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "project_id" text;
1871
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "selected_provider_id" text;
1872
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "selected_lane_id" text;
1873
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "selected_model" text;
1874
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "decision" text DEFAULT 'selected';
1875
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "reason" text;
1876
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "candidate_json" text DEFAULT '[]';
1877
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "score_json" text DEFAULT '{}';
1878
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1879
- ALTER TABLE "capacity_routing_decisions" ADD COLUMN IF NOT EXISTS "created_at" text;
1880
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "id" text;
1881
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "item_id" text;
1882
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "team_id" text;
1883
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "kind" text;
1884
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "version" text;
1885
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "content_key" text;
1886
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "manifest_key" text;
1887
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1888
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "published_at" text;
1889
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "created_at" text;
1890
- ALTER TABLE "catalog_artifact_versions" ADD COLUMN IF NOT EXISTS "updated_at" text;
1891
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "id" text;
1892
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "item_id" text;
1893
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "subject_type" text;
1894
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "subject_id" text;
1895
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "role" text;
1896
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1897
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "created_at" text;
1898
- ALTER TABLE "catalog_item_collaborators" ADD COLUMN IF NOT EXISTS "updated_at" text;
1899
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "id" text;
1900
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "team_id" text;
1901
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "kind" text;
1902
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "slug" text;
1903
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "title" text;
1904
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "summary" text;
1905
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "visibility" text;
1906
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "listing_enabled" integer DEFAULT 0;
1907
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "offer_mode" text;
1908
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "manifest_key" text;
1909
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "artifact_key" text;
1910
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "search_text" text;
1911
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1912
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "created_at" text;
1913
- ALTER TABLE "catalog_items" ADD COLUMN IF NOT EXISTS "updated_at" text;
1914
- ALTER TABLE "contact_submissions" ADD COLUMN IF NOT EXISTS "id" integer;
1915
- ALTER TABLE "contact_submissions" ADD COLUMN IF NOT EXISTS "email" text;
1916
- ALTER TABLE "contact_submissions" ADD COLUMN IF NOT EXISTS "message" text;
1917
- ALTER TABLE "contact_submissions" ADD COLUMN IF NOT EXISTS "created_at" text;
1918
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "id" text;
1919
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "task_signature" text;
1920
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "execution_profile_id" text DEFAULT 'standard-code-model';
1921
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "execution_provider_kind" text;
1922
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "native_unit" text;
1923
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "sample_count" integer DEFAULT 0;
1924
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "completed_sample_count" integer DEFAULT 0;
1925
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "interrupted_sample_count" integer DEFAULT 0;
1926
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "native_units_per_credit_p50" real;
1927
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "native_units_per_credit_p90" real;
1928
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "credits_per_native_unit_p50" real;
1929
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "credits_per_native_unit_p90" real;
1930
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "actual_credits_p50" real;
1931
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "actual_credits_p90" real;
1932
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "confidence" text DEFAULT 'low';
1933
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "formula_version" text;
1934
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1935
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "created_at" text;
1936
- ALTER TABLE "credit_conversion_profiles" ADD COLUMN IF NOT EXISTS "updated_at" text;
1937
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "agent_slug" text;
1938
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "cursor_key" text;
1939
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "status" text;
1940
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "schema_version" integer DEFAULT 1;
1941
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "updated_at" text;
1942
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "payload_json" text;
1943
- ALTER TABLE "cursor_state" ADD COLUMN IF NOT EXISTS "meta_json" text;
1944
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "id" text;
1945
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "device_code" text;
1946
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "user_code" text;
1947
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "requested_scopes_json" text;
1948
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "expires_at" text;
1949
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "interval_seconds" integer;
1950
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "status" text;
1951
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "user_id" text;
1952
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "created_at" text;
1953
- ALTER TABLE "device_codes" ADD COLUMN IF NOT EXISTS "updated_at" text;
1954
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "id" text;
1955
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "team_id" text;
1956
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "project_id" text;
1957
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "tier" text;
1958
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "status" text;
1959
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "metadata_json" text;
1960
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "created_at" text;
1961
- ALTER TABLE "entitlements" ADD COLUMN IF NOT EXISTS "updated_at" text;
1962
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "id" text;
1963
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "execution_provider_id" text;
1964
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "scope" text;
1965
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "native_unit" text;
1966
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "limit_amount" real;
1967
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "reserve_buffer_percent" real DEFAULT 0;
1968
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "reset_cadence" text;
1969
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "reset_at" text;
1970
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "confidence" text DEFAULT 'estimated';
1971
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "source" text DEFAULT 'configured';
1972
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1973
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "created_at" text;
1974
- ALTER TABLE "execution_provider_native_limits" ADD COLUMN IF NOT EXISTS "updated_at" text;
1975
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "id" text;
1976
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "execution_provider_id" text;
1977
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "observed_at" text;
1978
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "health" text DEFAULT 'unknown';
1979
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "active_workers" integer;
1980
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "queued_tasks" integer;
1981
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "throttle_state" text;
1982
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "native_remaining_json" text DEFAULT '{}';
1983
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "reset_at" text;
1984
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "confidence" text DEFAULT 'estimated';
1985
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1986
- ALTER TABLE "execution_provider_observations" ADD COLUMN IF NOT EXISTS "created_at" text;
1987
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "id" text;
1988
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "team_id" text;
1989
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
1990
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "name" text;
1991
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "kind" text;
1992
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
1993
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "native_unit" text;
1994
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "quota_visibility" text DEFAULT 'opaque';
1995
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "max_concurrent_workers" integer DEFAULT 1;
1996
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "reset_cadence" text;
1997
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "config_json" text DEFAULT '{}';
1998
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
1999
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "created_at" text;
2000
- ALTER TABLE "execution_providers" ADD COLUMN IF NOT EXISTS "updated_at" text;
2001
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "id" text;
2002
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2003
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "corpus_hash" text;
2004
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "graph_version" text;
2005
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "query_json" text;
2006
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "seed_ids_json" text;
2007
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "selected_node_ids_json" text;
2008
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "stats_json" text;
2009
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "snapshot_ref" text;
2010
- ALTER TABLE "graph_runs" ADD COLUMN IF NOT EXISTS "created_at" text;
2011
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "id" text;
2012
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "hub_id" text;
2013
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "team_id" text;
2014
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "content_repository_id" text;
2015
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "production_source" text;
2016
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "overlay_policy" text;
2017
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "r2_bucket_name" text;
2018
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "r2_manifest_key" text;
2019
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "r2_public_base_url" text;
2020
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "latest_publish_id" text;
2021
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "latest_content_version" text;
2022
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2023
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "created_at" text;
2024
- ALTER TABLE "hub_content_sources" ADD COLUMN IF NOT EXISTS "updated_at" text;
2025
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "id" text;
2026
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "launch_id" text;
2027
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "seq" integer;
2028
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "phase" text;
2029
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "status" text;
2030
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "title" text;
2031
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "summary" text;
2032
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "started_at" text;
2033
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "finished_at" text;
2034
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "error_json" text;
2035
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "data_json" text DEFAULT '{}';
2036
- ALTER TABLE "hub_launch_events" ADD COLUMN IF NOT EXISTS "created_at" text;
2037
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "id" text;
2038
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "hub_id" text;
2039
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "team_id" text;
2040
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "job_id" text;
2041
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "intent_json" text;
2042
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "plan_json" text DEFAULT '{}';
2043
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "state" text;
2044
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "current_phase" text;
2045
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "last_successful_phase" text;
2046
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "result_json" text;
2047
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "error_json" text;
2048
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "created_at" text;
2049
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "updated_at" text;
2050
- ALTER TABLE "hub_launches" ADD COLUMN IF NOT EXISTS "completed_at" text;
2051
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "id" text;
2052
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "hub_id" text;
2053
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "team_id" text;
2054
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "role" text;
2055
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "repository_host_id" text;
2056
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "provider" text;
2057
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "owner" text;
2058
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "name" text;
2059
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "url" text;
2060
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "default_branch" text;
2061
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "current_branch" text;
2062
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'queued';
2063
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "access_policy_json" text DEFAULT '{}';
2064
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "release_policy_json" text DEFAULT '{}';
2065
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "publish_policy_json" text DEFAULT '{}';
2066
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "submodule_path" text;
2067
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2068
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "created_at" text;
2069
- ALTER TABLE "hub_repositories" ADD COLUMN IF NOT EXISTS "updated_at" text;
2070
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "id" text;
2071
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "hub_id" text;
2072
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "team_id" text;
2073
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "parent_repository_host_id" text;
2074
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "parent_owner" text;
2075
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "parent_name" text;
2076
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "parent_url" text;
2077
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "parent_branch" text;
2078
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "hub_mount_path" text;
2079
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "software_submodule_path" text;
2080
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "content_submodule_path" text;
2081
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "update_submodule_pointers_enabled" integer DEFAULT 0;
2082
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "access_policy_json" text DEFAULT '{}';
2083
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2084
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "created_at" text;
2085
- ALTER TABLE "hub_workspace_links" ADD COLUMN IF NOT EXISTS "updated_at" text;
2086
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "id" text;
2087
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "team_id" text;
2088
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "slug" text;
2089
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "name" text;
2090
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "summary" text;
2091
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "source_kind" text;
2092
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "source_ref" text;
2093
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "install_strategy" text;
2094
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "visibility" text;
2095
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2096
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "created_at" text;
2097
- ALTER TABLE "knowledge_packs" ADD COLUMN IF NOT EXISTS "updated_at" text;
2098
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "model" text;
2099
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "item_key" text;
2100
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "status" text;
2101
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "schema_version" integer DEFAULT 1;
2102
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "claimed_by" text;
2103
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "claimed_at" text;
2104
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "lease_expires_at" text;
2105
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "created_at" text;
2106
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "updated_at" text;
2107
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "payload_json" text;
2108
- ALTER TABLE "lease_state" ADD COLUMN IF NOT EXISTS "meta_json" text;
2109
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "user_id" text;
2110
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "email" text;
2111
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "username" text;
2112
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "password_hash" text;
2113
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
2114
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "created_at" text;
2115
- ALTER TABLE "market_auth_credentials" ADD COLUMN IF NOT EXISTS "updated_at" text;
2116
- ALTER TABLE "market_auth_password_resets" ADD COLUMN IF NOT EXISTS "id" text;
2117
- ALTER TABLE "market_auth_password_resets" ADD COLUMN IF NOT EXISTS "user_id" text;
2118
- ALTER TABLE "market_auth_password_resets" ADD COLUMN IF NOT EXISTS "token_hash" text;
2119
- ALTER TABLE "market_auth_password_resets" ADD COLUMN IF NOT EXISTS "expires_at" text;
2120
- ALTER TABLE "market_auth_password_resets" ADD COLUMN IF NOT EXISTS "used_at" text;
2121
- ALTER TABLE "market_auth_password_resets" ADD COLUMN IF NOT EXISTS "created_at" text;
2122
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "id" text;
2123
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "runner_key" text;
2124
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "name" text;
2125
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "environment" text;
2126
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'online';
2127
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "version" text;
2128
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "capabilities_json" text DEFAULT '[]';
2129
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "active_job_count" integer DEFAULT 0;
2130
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "max_concurrent_jobs" integer DEFAULT 1;
2131
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "heartbeat_at" text;
2132
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2133
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "created_at" text;
2134
- ALTER TABLE "market_operation_runners" ADD COLUMN IF NOT EXISTS "updated_at" text;
2135
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "id" integer;
2136
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "message_type" text;
2137
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "status" text;
2138
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "schema_version" integer DEFAULT 1;
2139
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "related_model" text;
2140
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "related_id" text;
2141
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "priority" integer DEFAULT 0;
2142
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "available_at" text;
2143
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "claimed_by" text;
2144
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "claimed_at" text;
2145
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "lease_expires_at" text;
2146
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "attempts" integer DEFAULT 0;
2147
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "max_attempts" integer DEFAULT 3;
2148
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "created_at" text;
2149
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "updated_at" text;
2150
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "payload_json" text;
2151
- ALTER TABLE "message_queue" ADD COLUMN IF NOT EXISTS "meta_json" text;
2152
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "id" text;
2153
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "task_usage_actual_id" text;
2154
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "task_id" text;
2155
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2156
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "project_id" text;
2157
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "task_signature" text;
2158
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "execution_profile_id" text DEFAULT 'standard-code-model';
2159
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
2160
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "execution_provider_id" text;
2161
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "native_unit" text;
2162
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "native_usage_json" text DEFAULT '{}';
2163
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "observed_at" text;
2164
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "source" text DEFAULT 'provider_report';
2165
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "formula_version" text DEFAULT 'treeseed.actual-credits.v1';
2166
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "actual_credits" real;
2167
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2168
- ALTER TABLE "native_usage_observations" ADD COLUMN IF NOT EXISTS "created_at" text;
2169
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "id" text;
2170
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "key" text;
2171
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "resource" text;
2172
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "action" text;
2173
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "scope" text;
2174
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "description" text;
2175
- ALTER TABLE "permissions" ADD COLUMN IF NOT EXISTS "created_at" text;
2176
- ALTER TABLE "platform_operation_events" ADD COLUMN IF NOT EXISTS "id" text;
2177
- ALTER TABLE "platform_operation_events" ADD COLUMN IF NOT EXISTS "operation_id" text;
2178
- ALTER TABLE "platform_operation_events" ADD COLUMN IF NOT EXISTS "seq" integer;
2179
- ALTER TABLE "platform_operation_events" ADD COLUMN IF NOT EXISTS "kind" text;
2180
- ALTER TABLE "platform_operation_events" ADD COLUMN IF NOT EXISTS "data_json" text DEFAULT '{}';
2181
- ALTER TABLE "platform_operation_events" ADD COLUMN IF NOT EXISTS "created_at" text;
2182
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "id" text;
2183
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "namespace" text;
2184
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "operation" text;
2185
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "status" text;
2186
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "target" text;
2187
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "idempotency_key" text;
2188
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "input_json" text DEFAULT '{}';
2189
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "output_json" text;
2190
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "error_json" text;
2191
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "requested_by_type" text;
2192
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "requested_by_id" text;
2193
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "assigned_runner_id" text;
2194
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "lease_expires_at" text;
2195
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "created_at" text;
2196
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "updated_at" text;
2197
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "started_at" text;
2198
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "finished_at" text;
2199
- ALTER TABLE "platform_operations" ADD COLUMN IF NOT EXISTS "cancelled_at" text;
2200
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "id" text;
2201
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "repository_key" text;
2202
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "runner_id" text;
2203
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "workspace_path" text;
2204
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "branch" text;
2205
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "commit_sha" text;
2206
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "claim_state" text DEFAULT 'active';
2207
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "lease_expires_at" text;
2208
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2209
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "created_at" text;
2210
- ALTER TABLE "platform_repository_claims" ADD COLUMN IF NOT EXISTS "updated_at" text;
2211
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "id" text;
2212
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "project_id" text;
2213
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "model" text;
2214
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "subject_id" text;
2215
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "priority" real DEFAULT 0;
2216
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "estimated_credits" real;
2217
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2218
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "created_at" text;
2219
- ALTER TABLE "priority_overrides" ADD COLUMN IF NOT EXISTS "updated_at" text;
2220
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "id" text;
2221
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "project_id" text;
2222
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2223
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "snapshot_json" text;
2224
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2225
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "generated_at" text;
2226
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "created_at" text;
2227
- ALTER TABLE "priority_snapshots" ADD COLUMN IF NOT EXISTS "updated_at" text;
2228
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "id" text;
2229
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "project_id" text;
2230
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "label" text;
2231
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "namespace" text;
2232
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "operation" text;
2233
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "execution_class" text;
2234
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "allowed_targets_json" text;
2235
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "default_dispatch_mode" text;
2236
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "approval_policy_json" text DEFAULT '{}';
2237
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "resource_scope_json" text DEFAULT '{}';
2238
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2239
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "enabled" integer DEFAULT 1;
2240
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "created_at" text;
2241
- ALTER TABLE "project_capability_grants" ADD COLUMN IF NOT EXISTS "updated_at" text;
2242
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "id" text;
2243
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "project_id" text;
2244
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "mode" text;
2245
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "project_api_base_url" text;
2246
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "execution_owner" text;
2247
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "runner_registration_state" text DEFAULT 'pending';
2248
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "runner_key_prefix" text;
2249
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "runner_key_hash" text;
2250
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "runner_registered_at" text;
2251
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "runner_last_seen_at" text;
2252
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2253
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "created_at" text;
2254
- ALTER TABLE "project_connections" ADD COLUMN IF NOT EXISTS "updated_at" text;
2255
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "id" text;
2256
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "project_id" text;
2257
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "environment" text;
2258
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "deployment_kind" text;
2259
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "status" text;
2260
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "source_ref" text;
2261
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "release_tag" text;
2262
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "commit_sha" text;
2263
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "triggered_by_type" text;
2264
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "triggered_by_id" text;
2265
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2266
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "started_at" text;
2267
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "finished_at" text;
2268
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "created_at" text;
2269
- ALTER TABLE "project_deployments" ADD COLUMN IF NOT EXISTS "updated_at" text;
2270
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "id" text;
2271
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "project_id" text;
2272
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "environment" text;
2273
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "deployment_profile" text;
2274
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "base_url" text;
2275
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "cloudflare_account_id" text;
2276
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "pages_project_name" text;
2277
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "worker_name" text;
2278
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "r2_bucket_name" text;
2279
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "d1_database_name" text;
2280
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "queue_name" text;
2281
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "railway_project_name" text;
2282
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2283
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "created_at" text;
2284
- ALTER TABLE "project_environments" ADD COLUMN IF NOT EXISTS "updated_at" text;
2285
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "id" text;
2286
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "project_id" text;
2287
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "hosting_kind" text;
2288
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "registration" text DEFAULT 'none';
2289
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "market_base_url" text;
2290
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "source_repo_owner" text;
2291
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "source_repo_name" text;
2292
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "source_repo_url" text;
2293
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "source_repo_workflow_path" text;
2294
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2295
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "created_at" text;
2296
- ALTER TABLE "project_hosting" ADD COLUMN IF NOT EXISTS "updated_at" text;
2297
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "id" text;
2298
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "project_id" text;
2299
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "environment" text;
2300
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "provider" text;
2301
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "resource_kind" text;
2302
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "logical_name" text;
2303
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "locator" text;
2304
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2305
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "created_at" text;
2306
- ALTER TABLE "project_infrastructure_resources" ADD COLUMN IF NOT EXISTS "updated_at" text;
2307
- ALTER TABLE "project_summary_snapshots" ADD COLUMN IF NOT EXISTS "project_id" text;
2308
- ALTER TABLE "project_summary_snapshots" ADD COLUMN IF NOT EXISTS "team_id" text;
2309
- ALTER TABLE "project_summary_snapshots" ADD COLUMN IF NOT EXISTS "summary_json" text;
2310
- ALTER TABLE "project_summary_snapshots" ADD COLUMN IF NOT EXISTS "generated_at" text;
2311
- ALTER TABLE "project_summary_snapshots" ADD COLUMN IF NOT EXISTS "created_at" text;
2312
- ALTER TABLE "project_summary_snapshots" ADD COLUMN IF NOT EXISTS "updated_at" text;
2313
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "id" text;
2314
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "hub_id" text;
2315
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "team_id" text;
2316
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "source_kind" text;
2317
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "source_ref" text;
2318
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "source_version" text;
2319
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "plan_json" text DEFAULT '{}';
2320
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'planned';
2321
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "requires_decision" integer DEFAULT 0;
2322
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "decision_id" text;
2323
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "created_by" text;
2324
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "created_at" text;
2325
- ALTER TABLE "project_update_plans" ADD COLUMN IF NOT EXISTS "updated_at" text;
2326
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "id" text;
2327
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "project_id" text;
2328
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "environment" text;
2329
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2330
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "kind" text;
2331
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "state" text;
2332
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "started_at" text;
2333
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "ended_at" text;
2334
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "summary_json" text;
2335
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2336
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "created_at" text;
2337
- ALTER TABLE "project_workday_summaries" ADD COLUMN IF NOT EXISTS "updated_at" text;
2338
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "id" text;
2339
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "team_id" text;
2340
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "slug" text;
2341
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "name" text;
2342
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "description" text;
2343
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2344
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "created_at" text;
2345
- ALTER TABLE "projects" ADD COLUMN IF NOT EXISTS "updated_at" text;
2346
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "id" text;
2347
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "team_id" text;
2348
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "project_id" text;
2349
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "job_id" text;
2350
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "host_kind" text;
2351
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "host_id" text;
2352
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "purpose" text;
2353
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "encrypted_payload_json" text;
2354
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
2355
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "expires_at" text;
2356
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "consumed_at" text;
2357
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "created_by_id" text;
2358
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "created_at" text;
2359
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "updated_at" text;
2360
- ALTER TABLE "provider_credential_sessions" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2361
- ALTER TABLE "remote_job_events" ADD COLUMN IF NOT EXISTS "id" text;
2362
- ALTER TABLE "remote_job_events" ADD COLUMN IF NOT EXISTS "job_id" text;
2363
- ALTER TABLE "remote_job_events" ADD COLUMN IF NOT EXISTS "seq" integer;
2364
- ALTER TABLE "remote_job_events" ADD COLUMN IF NOT EXISTS "kind" text;
2365
- ALTER TABLE "remote_job_events" ADD COLUMN IF NOT EXISTS "data_json" text;
2366
- ALTER TABLE "remote_job_events" ADD COLUMN IF NOT EXISTS "created_at" text;
2367
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "id" text;
2368
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "project_id" text;
2369
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "namespace" text;
2370
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "operation" text;
2371
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "status" text;
2372
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "preferred_mode" text;
2373
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "selected_target" text;
2374
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "capability_json" text;
2375
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "input_json" text;
2376
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "output_json" text;
2377
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "error_json" text;
2378
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "requested_by_type" text;
2379
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "requested_by_id" text;
2380
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "assigned_runner_id" text;
2381
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "idempotency_key" text;
2382
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "created_at" text;
2383
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "updated_at" text;
2384
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "started_at" text;
2385
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "finished_at" text;
2386
- ALTER TABLE "remote_jobs" ADD COLUMN IF NOT EXISTS "cancelled_at" text;
2387
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "id" text;
2388
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2389
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "kind" text;
2390
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "body_json" text;
2391
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "rendered_ref" text;
2392
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "sent_at" text;
2393
- ALTER TABLE "reports" ADD COLUMN IF NOT EXISTS "created_at" text;
2394
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "id" text;
2395
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "project_id" text;
2396
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "repository_id" text;
2397
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "runner_id" text;
2398
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "runner_service_name" text;
2399
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "volume_identity" text;
2400
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "last_seen_commit" text;
2401
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "last_task_at" text;
2402
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "claim_state" text DEFAULT 'active';
2403
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2404
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "created_at" text;
2405
- ALTER TABLE "repository_claims" ADD COLUMN IF NOT EXISTS "updated_at" text;
2406
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "id" text;
2407
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "team_id" text;
2408
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "provider" text;
2409
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "ownership" text;
2410
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "name" text;
2411
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "account_label" text;
2412
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "organization_or_owner" text;
2413
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "default_visibility" text DEFAULT 'private';
2414
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "software_repository_name_template" text DEFAULT '{hub}-site';
2415
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "content_repository_name_template" text DEFAULT '{hub}-content';
2416
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "branch_policy_json" text DEFAULT '{}';
2417
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "workflow_policy_json" text DEFAULT '{}';
2418
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "encrypted_payload_json" text;
2419
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "allowed_project_kinds_json" text DEFAULT '["knowledge_hub"]';
2420
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2421
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
2422
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "created_by_id" text;
2423
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "updated_by_id" text;
2424
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "created_at" text;
2425
- ALTER TABLE "repository_hosts" ADD COLUMN IF NOT EXISTS "updated_at" text;
2426
- ALTER TABLE "role_permissions" ADD COLUMN IF NOT EXISTS "role_id" text;
2427
- ALTER TABLE "role_permissions" ADD COLUMN IF NOT EXISTS "permission_id" text;
2428
- ALTER TABLE "role_permissions" ADD COLUMN IF NOT EXISTS "created_at" text;
2429
- ALTER TABLE "roles" ADD COLUMN IF NOT EXISTS "id" text;
2430
- ALTER TABLE "roles" ADD COLUMN IF NOT EXISTS "key" text;
2431
- ALTER TABLE "roles" ADD COLUMN IF NOT EXISTS "description" text;
2432
- ALTER TABLE "roles" ADD COLUMN IF NOT EXISTS "created_at" text;
2433
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "id" text;
2434
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "project_id" text;
2435
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "environment" text;
2436
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2437
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "runner_id" text;
2438
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "runner_service_name" text;
2439
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "action" text;
2440
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "reason" text;
2441
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2442
- ALTER TABLE "runner_scale_decisions" ADD COLUMN IF NOT EXISTS "created_at" text;
2443
- ALTER TABLE "runtime_envelopes" ADD COLUMN IF NOT EXISTS "id" integer;
2444
- ALTER TABLE "runtime_envelopes" ADD COLUMN IF NOT EXISTS "record_type" text;
2445
- ALTER TABLE "runtime_envelopes" ADD COLUMN IF NOT EXISTS "payload_json" text;
2446
- ALTER TABLE "runtime_envelopes" ADD COLUMN IF NOT EXISTS "created_at" text;
2447
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "id" integer;
2448
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "record_type" text;
2449
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "record_key" text;
2450
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "lookup_key" text;
2451
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "secondary_key" text;
2452
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "status" text;
2453
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "schema_version" integer DEFAULT 1;
2454
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "created_at" text;
2455
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "updated_at" text;
2456
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "payload_json" text;
2457
- ALTER TABLE "runtime_records" ADD COLUMN IF NOT EXISTS "meta_json" text;
2458
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "id" text;
2459
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "project_id" text;
2460
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "environment" text;
2461
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "pool_name" text;
2462
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2463
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "desired_workers" integer;
2464
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "observed_queue_depth" integer DEFAULT 0;
2465
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "observed_active_leases" integer DEFAULT 0;
2466
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "reason" text;
2467
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2468
- ALTER TABLE "scale_decisions" ADD COLUMN IF NOT EXISTS "created_at" text;
2469
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "id" text;
2470
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "seed_name" text;
2471
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "seed_version" integer;
2472
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "environments_json" text;
2473
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "mode" text;
2474
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "state" text;
2475
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "actor_type" text;
2476
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "actor_id" text;
2477
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "manifest_hash" text;
2478
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "plan_json" text;
2479
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "result_json" text;
2480
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "error_json" text;
2481
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "created_at" text;
2482
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "updated_at" text;
2483
- ALTER TABLE "seed_runs" ADD COLUMN IF NOT EXISTS "completed_at" text;
2484
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "id" text;
2485
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "service_id" text;
2486
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "name" text;
2487
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "secret_hash" text;
2488
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "roles_json" text;
2489
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "permissions_json" text;
2490
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "revoked_at" text;
2491
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "created_at" text;
2492
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "updated_at" text;
2493
- ALTER TABLE "service_credentials" ADD COLUMN IF NOT EXISTS "last_used_at" text;
2494
- ALTER TABLE "subscribers" ADD COLUMN IF NOT EXISTS "email" text;
2495
- ALTER TABLE "subscribers" ADD COLUMN IF NOT EXISTS "created_at" text;
2496
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "id" text;
2497
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "project_id" text;
2498
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2499
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "task_id" text;
2500
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "phase" text;
2501
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "credits" real;
2502
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2503
- ALTER TABLE "task_credit_ledger" ADD COLUMN IF NOT EXISTS "created_at" text;
2504
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "task_signature" text;
2505
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "execution_profile_id" text DEFAULT 'standard-code-model';
2506
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "sample_count" integer DEFAULT 0;
2507
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "completed_sample_count" integer DEFAULT 0;
2508
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "interrupted_sample_count" integer DEFAULT 0;
2509
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "input_tokens_p50" integer;
2510
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "input_tokens_p90" integer;
2511
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "output_tokens_p50" integer;
2512
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "output_tokens_p90" integer;
2513
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "quota_minutes_p50" real;
2514
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "quota_minutes_p90" real;
2515
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "files_changed_p50" real;
2516
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "files_changed_p90" real;
2517
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "credits_p50" real;
2518
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "credits_p90" real;
2519
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "credits_variance" real;
2520
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "confidence_score" real;
2521
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "outlier_count" integer DEFAULT 0;
2522
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "partial_credits" real;
2523
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "first_sample_at" text;
2524
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "last_sample_at" text;
2525
- ALTER TABLE "task_estimate_profiles" ADD COLUMN IF NOT EXISTS "updated_at" text;
2526
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "id" text;
2527
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "task_id" text;
2528
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2529
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "project_id" text;
2530
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimate_phase" text;
2531
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "task_signature" text;
2532
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "confidence" text;
2533
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_credits_p50" real;
2534
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_credits_p90" real;
2535
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "reserved_credits" real;
2536
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_input_tokens_p50" integer;
2537
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_input_tokens_p90" integer;
2538
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_output_tokens_p50" integer;
2539
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_output_tokens_p90" integer;
2540
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_quota_minutes_p50" real;
2541
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "estimated_quota_minutes_p90" real;
2542
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "features_json" text DEFAULT '{}';
2543
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "created_at" text;
2544
- ALTER TABLE "task_estimates" ADD COLUMN IF NOT EXISTS "execution_profile_id" text DEFAULT 'standard-code-model';
2545
- ALTER TABLE "task_events" ADD COLUMN IF NOT EXISTS "id" text;
2546
- ALTER TABLE "task_events" ADD COLUMN IF NOT EXISTS "task_id" text;
2547
- ALTER TABLE "task_events" ADD COLUMN IF NOT EXISTS "seq" integer;
2548
- ALTER TABLE "task_events" ADD COLUMN IF NOT EXISTS "kind" text;
2549
- ALTER TABLE "task_events" ADD COLUMN IF NOT EXISTS "data_json" text;
2550
- ALTER TABLE "task_events" ADD COLUMN IF NOT EXISTS "created_at" text;
2551
- ALTER TABLE "task_outputs" ADD COLUMN IF NOT EXISTS "id" text;
2552
- ALTER TABLE "task_outputs" ADD COLUMN IF NOT EXISTS "task_id" text;
2553
- ALTER TABLE "task_outputs" ADD COLUMN IF NOT EXISTS "output_json" text;
2554
- ALTER TABLE "task_outputs" ADD COLUMN IF NOT EXISTS "output_ref" text;
2555
- ALTER TABLE "task_outputs" ADD COLUMN IF NOT EXISTS "created_at" text;
2556
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "id" text;
2557
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "task_id" text;
2558
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2559
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "project_id" text;
2560
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "task_signature" text;
2561
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "capacity_provider_id" text;
2562
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "execution_provider_id" text;
2563
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "lane_id" text;
2564
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "business_model" text;
2565
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "model_name" text;
2566
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "input_tokens" integer;
2567
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "output_tokens" integer;
2568
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "cached_input_tokens" integer;
2569
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "quota_minutes" real;
2570
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "wall_minutes" real;
2571
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "files_opened" integer;
2572
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "files_changed" integer;
2573
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "diff_lines_added" integer;
2574
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "diff_lines_removed" integer;
2575
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "test_runs" integer;
2576
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "retry_count" integer;
2577
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "actual_credits" real;
2578
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "actual_usd" real;
2579
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "credit_formula_version" text DEFAULT 'treeseed.actual-credits.v1';
2580
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "actual_credit_source" text DEFAULT 'central_calculator';
2581
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "native_usage_json" text DEFAULT '{}';
2582
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2583
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "created_at" text;
2584
- ALTER TABLE "task_usage_actuals" ADD COLUMN IF NOT EXISTS "execution_profile_id" text DEFAULT 'standard-code-model';
2585
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "id" text;
2586
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2587
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "agent_id" text;
2588
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "type" text;
2589
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "state" text;
2590
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "priority" integer DEFAULT 0;
2591
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "idempotency_key" text;
2592
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "payload_json" text;
2593
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "payload_hash" text;
2594
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "attempt_count" integer DEFAULT 0;
2595
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "max_attempts" integer DEFAULT 3;
2596
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "claimed_by" text;
2597
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "lease_expires_at" text;
2598
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "available_at" text;
2599
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "last_error_code" text;
2600
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "last_error_message" text;
2601
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "graph_version" text;
2602
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "parent_task_id" text;
2603
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "created_at" text;
2604
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "started_at" text;
2605
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "completed_at" text;
2606
- ALTER TABLE "tasks" ADD COLUMN IF NOT EXISTS "updated_at" text;
2607
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "id" text;
2608
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "team_id" text;
2609
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "name" text;
2610
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "key_prefix" text;
2611
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "key_hash" text;
2612
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "permissions_json" text;
2613
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "expires_at" text;
2614
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "last_used_at" text;
2615
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "revoked_at" text;
2616
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "created_at" text;
2617
- ALTER TABLE "team_api_keys" ADD COLUMN IF NOT EXISTS "updated_at" text;
2618
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "id" text;
2619
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "team_id" text;
2620
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "project_id" text;
2621
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "kind" text;
2622
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "state" text;
2623
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "title" text;
2624
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "summary" text;
2625
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "href" text;
2626
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "item_key" text;
2627
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "metadata_json" text DEFAULT '{}';
2628
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "created_at" text;
2629
- ALTER TABLE "team_inbox_items" ADD COLUMN IF NOT EXISTS "updated_at" text;
2630
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "id" text;
2631
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "team_id" text;
2632
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "email" text;
2633
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "role_key" text;
2634
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "token_prefix" text;
2635
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "token_hash" text;
2636
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'pending';
2637
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "invited_by_user_id" text;
2638
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "accepted_by_user_id" text;
2639
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "accepted_at" text;
2640
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "expires_at" text;
2641
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "created_at" text;
2642
- ALTER TABLE "team_invites" ADD COLUMN IF NOT EXISTS "updated_at" text;
2643
- ALTER TABLE "team_memberships" ADD COLUMN IF NOT EXISTS "id" text;
2644
- ALTER TABLE "team_memberships" ADD COLUMN IF NOT EXISTS "team_id" text;
2645
- ALTER TABLE "team_memberships" ADD COLUMN IF NOT EXISTS "user_id" text;
2646
- ALTER TABLE "team_memberships" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
2647
- ALTER TABLE "team_memberships" ADD COLUMN IF NOT EXISTS "created_at" text;
2648
- ALTER TABLE "team_memberships" ADD COLUMN IF NOT EXISTS "updated_at" text;
2649
- ALTER TABLE "team_role_bindings" ADD COLUMN IF NOT EXISTS "id" text;
2650
- ALTER TABLE "team_role_bindings" ADD COLUMN IF NOT EXISTS "team_membership_id" text;
2651
- ALTER TABLE "team_role_bindings" ADD COLUMN IF NOT EXISTS "role_id" text;
2652
- ALTER TABLE "team_role_bindings" ADD COLUMN IF NOT EXISTS "created_at" text;
2653
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "id" text;
2654
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "team_id" text;
2655
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "bucket_name" text;
2656
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "manifest_key_template" text;
2657
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "preview_root_template" text;
2658
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "public_base_url" text;
2659
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2660
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "created_at" text;
2661
- ALTER TABLE "team_storage_locators" ADD COLUMN IF NOT EXISTS "updated_at" text;
2662
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "id" text;
2663
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "team_id" text;
2664
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "provider" text;
2665
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "ownership" text;
2666
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "name" text;
2667
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "account_label" text;
2668
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "allowed_environments_json" text DEFAULT '[]';
2669
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
2670
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "encrypted_payload_json" text;
2671
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2672
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "created_by_id" text;
2673
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "updated_by_id" text;
2674
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "created_at" text;
2675
- ALTER TABLE "team_web_hosts" ADD COLUMN IF NOT EXISTS "updated_at" text;
2676
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "id" text;
2677
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "slug" text;
2678
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "name" text;
2679
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2680
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "created_at" text;
2681
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "updated_at" text;
2682
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "display_name" text;
2683
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "logo_url" text;
2684
- ALTER TABLE "teams" ADD COLUMN IF NOT EXISTS "profile_summary" text;
2685
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "id" text;
2686
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "user_id" text;
2687
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "provider" text;
2688
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "provider_subject" text;
2689
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "email" text;
2690
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "email_verified" integer DEFAULT 0;
2691
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "profile_json" text;
2692
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "created_at" text;
2693
- ALTER TABLE "user_identities" ADD COLUMN IF NOT EXISTS "updated_at" text;
2694
- ALTER TABLE "user_preferences" ADD COLUMN IF NOT EXISTS "user_id" text;
2695
- ALTER TABLE "user_preferences" ADD COLUMN IF NOT EXISTS "color_scheme" text DEFAULT 'fern';
2696
- ALTER TABLE "user_preferences" ADD COLUMN IF NOT EXISTS "theme_mode" text DEFAULT 'system';
2697
- ALTER TABLE "user_preferences" ADD COLUMN IF NOT EXISTS "created_at" text;
2698
- ALTER TABLE "user_preferences" ADD COLUMN IF NOT EXISTS "updated_at" text;
2699
- ALTER TABLE "user_role_bindings" ADD COLUMN IF NOT EXISTS "id" text;
2700
- ALTER TABLE "user_role_bindings" ADD COLUMN IF NOT EXISTS "user_id" text;
2701
- ALTER TABLE "user_role_bindings" ADD COLUMN IF NOT EXISTS "role_id" text;
2702
- ALTER TABLE "user_role_bindings" ADD COLUMN IF NOT EXISTS "created_at" text;
2703
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "id" text;
2704
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "email" text;
2705
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "display_name" text;
2706
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "status" text DEFAULT 'active';
2707
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2708
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "created_at" text;
2709
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "updated_at" text;
2710
- ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "username" text;
2711
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "id" text;
2712
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "user_id" text;
2713
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "identity_id" text;
2714
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "better_auth_session_id" text;
2715
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "provider" text;
2716
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "provider_subject" text;
2717
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "email" text;
2718
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "display_name" text;
2719
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "principal_json" text;
2720
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "csrf_token" text;
2721
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "ip_address" text;
2722
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "user_agent" text;
2723
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "authenticated_at" text;
2724
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "last_seen_at" text;
2725
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "expires_at" text;
2726
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "revoked_at" text;
2727
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "created_at" text;
2728
- ALTER TABLE "web_sessions" ADD COLUMN IF NOT EXISTS "updated_at" text;
2729
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "id" text;
2730
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "project_id" text;
2731
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "state" text;
2732
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "capacity_budget" integer DEFAULT 0;
2733
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "capacity_used" integer DEFAULT 0;
2734
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "graph_version" text;
2735
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "summary_json" text;
2736
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "started_at" text;
2737
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "ended_at" text;
2738
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "created_at" text;
2739
- ALTER TABLE "work_days" ADD COLUMN IF NOT EXISTS "updated_at" text;
2740
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "project_id" text;
2741
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "environment" text;
2742
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "schedule_json" text;
2743
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "daily_task_credit_budget" integer DEFAULT 0;
2744
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "max_queued_tasks" integer DEFAULT 0;
2745
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "max_queued_credits" integer DEFAULT 0;
2746
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "autoscale_json" text;
2747
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "credit_weights_json" text;
2748
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2749
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "created_at" text;
2750
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "updated_at" text;
2751
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "enabled" integer DEFAULT 1;
2752
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "start_cron" text DEFAULT '0 9 * * 1-5';
2753
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "duration_minutes" integer DEFAULT 480;
2754
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "max_runners" integer DEFAULT 1;
2755
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "max_workers_per_runner" integer DEFAULT 4;
2756
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "daily_credit_budget" integer DEFAULT 0;
2757
- ALTER TABLE "work_policies" ADD COLUMN IF NOT EXISTS "closeout_grace_minutes" integer DEFAULT 15;
2758
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "id" text;
2759
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "project_id" text;
2760
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "environment" text;
2761
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2762
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "manager_id" text;
2763
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'active';
2764
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "heartbeat_at" text;
2765
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "expires_at" text;
2766
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2767
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "created_at" text;
2768
- ALTER TABLE "workday_manager_leases" ADD COLUMN IF NOT EXISTS "updated_at" text;
2769
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "id" text;
2770
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "project_id" text;
2771
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "environment" text;
2772
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "type" text;
2773
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'pending';
2774
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "work_day_id" text;
2775
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "requested_by" text;
2776
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "reason" text;
2777
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "payload_json" text;
2778
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2779
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "created_at" text;
2780
- ALTER TABLE "workday_requests" ADD COLUMN IF NOT EXISTS "updated_at" text;
2781
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "id" text;
2782
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "project_id" text;
2783
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "environment" text;
2784
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "runner_id" text;
2785
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "runner_service_name" text;
2786
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "volume_identity" text;
2787
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "state" text DEFAULT 'active';
2788
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "max_local_workers" integer DEFAULT 4;
2789
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "active_local_workers" integer DEFAULT 0;
2790
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "available_capacity" integer DEFAULT 4;
2791
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "last_heartbeat_at" text;
2792
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "claimed_repository_ids_json" text;
2793
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "metadata_json" text;
2794
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "created_at" text;
2795
- ALTER TABLE "worker_runners" ADD COLUMN IF NOT EXISTS "updated_at" text;
2796
- -- End Treeseed Market schema adoption columns
2797
-
2798
- -- Backfill verified account emails from existing active credential rows.
2799
- INSERT INTO user_email_addresses (
2800
- id, user_id, email, normalized_email, status, is_primary, verification_requested_at, verified_at, created_at, updated_at
2801
- )
2802
- SELECT 'email_' || md5(user_id || ':' || LOWER(email)), user_id, email, LOWER(email), 'verified', 1, created_at, COALESCE(updated_at, created_at), created_at, updated_at
2803
- FROM market_auth_credentials
2804
- WHERE email IS NOT NULL
2805
- AND email != ''
2806
- AND status = 'active'
2807
- ON CONFLICT (normalized_email) DO NOTHING;
2808
-
2809
- CREATE INDEX IF NOT EXISTS "idx_agent_pool_registrations_pool_heartbeat" ON "agent_pool_registrations" USING btree ("pool_id","heartbeat_at");
2810
- CREATE INDEX IF NOT EXISTS "idx_agent_pool_scale_decisions_pool_created" ON "agent_pool_scale_decisions" USING btree ("pool_id","created_at");
2811
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_agent_pools_project_environment_name" ON "agent_pools" USING btree ("project_id","environment","name");
2812
- CREATE INDEX IF NOT EXISTS "idx_api_tokens_user_id" ON "api_tokens" USING btree ("user_id");
2813
- CREATE INDEX IF NOT EXISTS "idx_api_tokens_prefix" ON "api_tokens" USING btree ("token_prefix");
2814
- CREATE INDEX IF NOT EXISTS "idx_approval_requests_team_state" ON "approval_requests" USING btree ("team_id","state","created_at");
2815
- CREATE INDEX IF NOT EXISTS "idx_approval_requests_project_workday" ON "approval_requests" USING btree ("project_id","work_day_id","state","created_at");
2816
- CREATE INDEX IF NOT EXISTS "idx_audit_events_target" ON "audit_events" USING btree ("target_type","target_id");
2817
- CREATE INDEX IF NOT EXISTS "idx_auth_sessions_user_id" ON "auth_sessions" USING btree ("user_id");
2818
- CREATE INDEX IF NOT EXISTS "idx_better_auth_account_userId" ON "better_auth_account" USING btree ("userId");
2819
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_better_auth_account_provider_account" ON "better_auth_account" USING btree ("providerId","accountId");
2820
- CREATE INDEX IF NOT EXISTS "idx_better_auth_session_token" ON "better_auth_session" USING btree ("token");
2821
- CREATE INDEX IF NOT EXISTS "idx_better_auth_session_userId" ON "better_auth_session" USING btree ("userId");
2822
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_better_auth_user_username" ON "better_auth_user" USING btree ("username");
2823
- CREATE INDEX IF NOT EXISTS "idx_better_auth_verification_identifier" ON "better_auth_verification" USING btree ("identifier");
2824
- CREATE INDEX IF NOT EXISTS "idx_capacity_grants_team_project" ON "capacity_grants" USING btree ("team_id","project_id","state");
2825
- CREATE INDEX IF NOT EXISTS "idx_capacity_grants_provider_lane" ON "capacity_grants" USING btree ("capacity_provider_id","lane_id","state");
2826
- CREATE INDEX IF NOT EXISTS "idx_capacity_ledger_project_workday_created" ON "capacity_ledger_entries" USING btree ("project_id","work_day_id","created_at");
2827
- CREATE INDEX IF NOT EXISTS "idx_capacity_provider_api_keys_provider_status" ON "capacity_provider_api_keys" USING btree ("capacity_provider_id","status","created_at");
2828
- CREATE INDEX IF NOT EXISTS "idx_capacity_provider_api_keys_prefix" ON "capacity_provider_api_keys" USING btree ("key_prefix");
2829
- CREATE INDEX IF NOT EXISTS "idx_capacity_provider_deployments_provider_created" ON "capacity_provider_deployments" USING btree ("capacity_provider_id","created_at");
2830
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_capacity_provider_hosts_unique" ON "capacity_provider_hosts" USING btree ("capacity_provider_id","host_id","role");
2831
- CREATE INDEX IF NOT EXISTS "idx_capacity_provider_lanes_provider" ON "capacity_provider_lanes" USING btree ("capacity_provider_id","business_model","scarcity_level");
2832
- CREATE INDEX IF NOT EXISTS "idx_capacity_provider_registrations_provider_seen" ON "capacity_provider_registrations" USING btree ("capacity_provider_id","last_seen_at");
2833
- CREATE INDEX IF NOT EXISTS "idx_capacity_providers_team_status" ON "capacity_providers" USING btree ("team_id","status","provider");
2834
- CREATE INDEX IF NOT EXISTS "idx_capacity_reservations_project_workday_state" ON "capacity_reservations" USING btree ("project_id","work_day_id","state","created_at");
2835
- CREATE INDEX IF NOT EXISTS "idx_capacity_reservations_provider_state" ON "capacity_reservations" USING btree ("capacity_provider_id","lane_id","state");
2836
- CREATE INDEX IF NOT EXISTS "idx_capacity_reservations_execution_provider_state" ON "capacity_reservations" USING btree ("execution_provider_id","state","created_at");
2837
- CREATE INDEX IF NOT EXISTS "idx_capacity_routing_decisions_project_workday" ON "capacity_routing_decisions" USING btree ("project_id","work_day_id","created_at");
2838
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_catalog_artifact_versions_item_version" ON "catalog_artifact_versions" USING btree ("item_id","version");
2839
- CREATE INDEX IF NOT EXISTS "idx_catalog_artifact_versions_team_kind" ON "catalog_artifact_versions" USING btree ("team_id","kind","published_at");
2840
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_catalog_item_collaborators_subject_role" ON "catalog_item_collaborators" USING btree ("item_id","subject_type","subject_id","role");
2841
- CREATE INDEX IF NOT EXISTS "idx_catalog_items_team_kind" ON "catalog_items" USING btree ("team_id","kind","updated_at");
2842
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_catalog_items_team_kind_slug" ON "catalog_items" USING btree ("team_id","kind","slug");
2843
- CREATE INDEX IF NOT EXISTS "idx_catalog_items_visibility_listing" ON "catalog_items" USING btree ("visibility","listing_enabled","updated_at");
2844
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_credit_conversion_profiles_profile_key" ON "credit_conversion_profiles" USING btree ("task_signature","execution_profile_id","execution_provider_kind","native_unit");
2845
- CREATE INDEX IF NOT EXISTS "idx_credit_conversion_profiles_kind_unit" ON "credit_conversion_profiles" USING btree ("execution_provider_kind","native_unit","updated_at");
2846
- CREATE INDEX IF NOT EXISTS "idx_cursor_state_updated" ON "cursor_state" USING btree ("updated_at");
2847
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_entitlements_project" ON "entitlements" USING btree ("project_id");
2848
- CREATE INDEX IF NOT EXISTS "idx_execution_provider_native_limits_provider_scope" ON "execution_provider_native_limits" USING btree ("execution_provider_id","scope","native_unit");
2849
- CREATE INDEX IF NOT EXISTS "idx_execution_provider_observations_provider_observed" ON "execution_provider_observations" USING btree ("execution_provider_id","observed_at");
2850
- CREATE INDEX IF NOT EXISTS "idx_execution_providers_team_status" ON "execution_providers" USING btree ("team_id","status","kind");
2851
- CREATE INDEX IF NOT EXISTS "idx_execution_providers_capacity_provider" ON "execution_providers" USING btree ("capacity_provider_id","status");
2852
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_hub_launch_events_launch_seq" ON "hub_launch_events" USING btree ("launch_id","seq");
2853
- CREATE INDEX IF NOT EXISTS "idx_hub_launches_hub_created" ON "hub_launches" USING btree ("hub_id","created_at");
2854
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_hub_repositories_hub_role" ON "hub_repositories" USING btree ("hub_id","role");
2855
- CREATE INDEX IF NOT EXISTS "idx_hub_workspace_links_hub" ON "hub_workspace_links" USING btree ("hub_id");
2856
- CREATE INDEX IF NOT EXISTS "idx_knowledge_packs_team_id" ON "knowledge_packs" USING btree ("team_id");
2857
- CREATE INDEX IF NOT EXISTS "idx_lease_state_status_expires" ON "lease_state" USING btree ("status","lease_expires_at");
2858
- CREATE INDEX IF NOT EXISTS "idx_lease_state_claimed_by" ON "lease_state" USING btree ("claimed_by","updated_at");
2859
- CREATE INDEX IF NOT EXISTS "idx_message_queue_claimable" ON "message_queue" USING btree ("status","available_at","priority");
2860
- CREATE INDEX IF NOT EXISTS "idx_message_queue_related" ON "message_queue" USING btree ("related_model","related_id","created_at");
2861
- CREATE INDEX IF NOT EXISTS "idx_native_usage_observations_profile" ON "native_usage_observations" USING btree ("project_id","task_signature","execution_profile_id","created_at");
2862
- CREATE INDEX IF NOT EXISTS "idx_native_usage_observations_provider" ON "native_usage_observations" USING btree ("execution_provider_id","created_at");
2863
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_platform_operation_events_seq" ON "platform_operation_events" USING btree ("operation_id","seq");
2864
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_platform_operations_idempotency" ON "platform_operations" USING btree ("namespace","operation","idempotency_key");
2865
- CREATE INDEX IF NOT EXISTS "idx_platform_operations_runnable" ON "platform_operations" USING btree ("status","created_at");
2866
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_platform_repository_claims_active" ON "platform_repository_claims" USING btree ("repository_key","runner_id");
2867
- CREATE INDEX IF NOT EXISTS "idx_platform_repository_claims_runner" ON "platform_repository_claims" USING btree ("runner_id","claim_state");
2868
- CREATE INDEX IF NOT EXISTS "idx_priority_overrides_project_priority" ON "priority_overrides" USING btree ("project_id","priority","updated_at");
2869
- CREATE INDEX IF NOT EXISTS "idx_priority_snapshots_project_generated" ON "priority_snapshots" USING btree ("project_id","generated_at");
2870
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_project_capability_grants_project_operation" ON "project_capability_grants" USING btree ("project_id","namespace","operation");
2871
- CREATE INDEX IF NOT EXISTS "idx_project_deployment_events_deployment_sequence" ON "project_deployment_events" USING btree ("deployment_id","sequence");
2872
- CREATE INDEX IF NOT EXISTS "idx_project_deployment_events_project_created" ON "project_deployment_events" USING btree ("project_id","created_at");
2873
- CREATE INDEX IF NOT EXISTS "idx_project_deployment_events_operation" ON "project_deployment_events" USING btree ("operation_id");
2874
- CREATE INDEX IF NOT EXISTS "idx_project_deployments_project_created" ON "project_deployments" USING btree ("project_id","created_at");
2875
- CREATE INDEX IF NOT EXISTS "idx_project_deployments_project_environment" ON "project_deployments" USING btree ("project_id","environment","created_at");
2876
- CREATE INDEX IF NOT EXISTS "idx_project_deployments_project_status" ON "project_deployments" USING btree ("project_id","status","updated_at");
2877
- CREATE INDEX IF NOT EXISTS "idx_project_deployments_operation" ON "project_deployments" USING btree ("platform_operation_id");
2878
- CREATE INDEX IF NOT EXISTS "idx_project_deployments_team_created" ON "project_deployments" USING btree ("team_id","created_at");
2879
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_project_deployments_idempotency" ON "project_deployments" USING btree ("project_id","idempotency_key");
2880
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_project_environments_project_environment" ON "project_environments" USING btree ("project_id","environment");
2881
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_project_infrastructure_resource_unique" ON "project_infrastructure_resources" USING btree ("project_id","environment","provider","resource_kind","logical_name");
2882
- CREATE INDEX IF NOT EXISTS "idx_project_summary_snapshots_team_generated" ON "project_summary_snapshots" USING btree ("team_id","generated_at");
2883
- CREATE INDEX IF NOT EXISTS "idx_project_update_plans_hub" ON "project_update_plans" USING btree ("hub_id","created_at");
2884
- CREATE INDEX IF NOT EXISTS "idx_project_workday_summaries_project_environment_created" ON "project_workday_summaries" USING btree ("project_id","environment","created_at");
2885
- CREATE INDEX IF NOT EXISTS "idx_projects_team_id" ON "projects" USING btree ("team_id");
2886
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_projects_team_slug" ON "projects" USING btree ("team_id","slug");
2887
- CREATE INDEX IF NOT EXISTS "idx_provider_credential_sessions_team_host" ON "provider_credential_sessions" USING btree ("team_id","host_kind","host_id","status");
2888
- CREATE INDEX IF NOT EXISTS "idx_provider_credential_sessions_job" ON "provider_credential_sessions" USING btree ("job_id","status");
2889
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_remote_job_events_job_seq" ON "remote_job_events" USING btree ("job_id","seq");
2890
- CREATE INDEX IF NOT EXISTS "idx_remote_jobs_project_status" ON "remote_jobs" USING btree ("project_id","status","created_at");
2891
- CREATE INDEX IF NOT EXISTS "idx_remote_jobs_project_idempotency" ON "remote_jobs" USING btree ("project_id","idempotency_key");
2892
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_repository_claims_runner_repo" ON "repository_claims" USING btree ("project_id","repository_id","runner_id");
2893
- CREATE INDEX IF NOT EXISTS "idx_repository_claims_repo_state" ON "repository_claims" USING btree ("project_id","repository_id","claim_state","updated_at");
2894
- CREATE INDEX IF NOT EXISTS "idx_repository_hosts_team_provider" ON "repository_hosts" USING btree ("team_id","provider","status");
2895
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_repository_hosts_team_provider_name" ON "repository_hosts" USING btree ("team_id","provider","name");
2896
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_repository_hosts_platform_provider_name" ON "repository_hosts" USING btree ("provider","name");
2897
- CREATE INDEX IF NOT EXISTS "idx_runner_scale_decisions_project_workday" ON "runner_scale_decisions" USING btree ("project_id","environment","work_day_id","created_at");
2898
- CREATE INDEX IF NOT EXISTS "idx_runtime_records_type_lookup_updated" ON "runtime_records" USING btree ("record_type","lookup_key","updated_at");
2899
- CREATE INDEX IF NOT EXISTS "idx_runtime_records_type_status_updated" ON "runtime_records" USING btree ("record_type","status","updated_at");
2900
- CREATE INDEX IF NOT EXISTS "idx_scale_decisions_project_environment_pool_created" ON "scale_decisions" USING btree ("project_id","environment","pool_name","created_at");
2901
- CREATE INDEX IF NOT EXISTS "idx_seed_runs_seed_created" ON "seed_runs" USING btree ("seed_name","created_at");
2902
- CREATE INDEX IF NOT EXISTS "idx_seed_runs_state_created" ON "seed_runs" USING btree ("state","created_at");
2903
- CREATE INDEX IF NOT EXISTS "idx_task_credit_ledger_work_day_created" ON "task_credit_ledger" USING btree ("work_day_id","created_at");
2904
- CREATE INDEX IF NOT EXISTS "idx_task_estimates_project_signature" ON "task_estimates" USING btree ("project_id","task_signature","created_at");
2905
- CREATE INDEX IF NOT EXISTS "idx_task_estimates_project_signature_profile" ON "task_estimates" USING btree ("project_id","task_signature","execution_profile_id","created_at");
2906
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_task_events_seq" ON "task_events" USING btree ("task_id","seq");
2907
- CREATE INDEX IF NOT EXISTS "idx_task_usage_actuals_project_signature" ON "task_usage_actuals" USING btree ("project_id","task_signature","created_at");
2908
- CREATE INDEX IF NOT EXISTS "idx_task_usage_actuals_project_signature_profile" ON "task_usage_actuals" USING btree ("project_id","task_signature","execution_profile_id","created_at");
2909
- CREATE INDEX IF NOT EXISTS "idx_task_usage_actuals_execution_provider" ON "task_usage_actuals" USING btree ("execution_provider_id","created_at");
2910
- CREATE INDEX IF NOT EXISTS "idx_tasks_runnable" ON "tasks" USING btree ("state","priority","available_at");
2911
- CREATE INDEX IF NOT EXISTS "idx_tasks_work_day_agent" ON "tasks" USING btree ("work_day_id","agent_id","created_at");
2912
- CREATE INDEX IF NOT EXISTS "idx_team_api_keys_prefix" ON "team_api_keys" USING btree ("key_prefix");
2913
- CREATE INDEX IF NOT EXISTS "idx_team_inbox_items_team_created" ON "team_inbox_items" USING btree ("team_id","created_at");
2914
- CREATE INDEX IF NOT EXISTS "idx_team_invites_team_status" ON "team_invites" USING btree ("team_id","status","created_at");
2915
- CREATE INDEX IF NOT EXISTS "idx_team_invites_token_prefix" ON "team_invites" USING btree ("token_prefix");
2916
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_team_memberships_team_user" ON "team_memberships" USING btree ("team_id","user_id");
2917
- CREATE INDEX IF NOT EXISTS "idx_team_web_hosts_team_provider" ON "team_web_hosts" USING btree ("team_id","provider","status");
2918
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_team_web_hosts_team_provider_name" ON "team_web_hosts" USING btree ("team_id","provider","name");
2919
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_teams_name" ON "teams" USING btree ("name");
2920
- CREATE INDEX IF NOT EXISTS "idx_user_email_addresses_user" ON "user_email_addresses" USING btree ("user_id","status","is_primary");
2921
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_user_email_addresses_normalized" ON "user_email_addresses" USING btree ("normalized_email");
2922
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_user_identities_provider_subject" ON "user_identities" USING btree ("provider","provider_subject");
2923
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_user_role_bindings_user_role" ON "user_role_bindings" USING btree ("user_id","role_id");
2924
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_users_username" ON "users" USING btree ("username");
2925
- CREATE INDEX IF NOT EXISTS "idx_web_sessions_user_id" ON "web_sessions" USING btree ("user_id");
2926
- CREATE INDEX IF NOT EXISTS "idx_workday_manager_leases_active" ON "workday_manager_leases" USING btree ("project_id","environment","state","heartbeat_at");
2927
- CREATE INDEX IF NOT EXISTS "idx_workday_requests_project_environment_state" ON "workday_requests" USING btree ("project_id","environment","state","created_at");
2928
- CREATE UNIQUE INDEX IF NOT EXISTS "idx_worker_runners_identity" ON "worker_runners" USING btree ("project_id","environment","runner_id");
2929
- CREATE INDEX IF NOT EXISTS "idx_worker_runners_state_capacity" ON "worker_runners" USING btree ("project_id","environment","state","available_capacity");
2852
+ CREATE TABLE "workflow_dispatch_records" (
2853
+ "id" text PRIMARY KEY NOT NULL,
2854
+ "team_id" text NOT NULL,
2855
+ "project_id" text,
2856
+ "workflow_operation_id" text NOT NULL,
2857
+ "platform_operation_id" text,
2858
+ "repository" text NOT NULL,
2859
+ "workflow_file" text NOT NULL,
2860
+ "ref" text,
2861
+ "status" text DEFAULT 'queued' NOT NULL,
2862
+ "inputs_json" text DEFAULT '{}' NOT NULL,
2863
+ "result_json" text DEFAULT '{}' NOT NULL,
2864
+ "fail_closed_code" text,
2865
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2866
+ "created_at" text NOT NULL,
2867
+ "updated_at" text NOT NULL,
2868
+ "dispatched_at" text,
2869
+ "completed_at" text
2870
+ );
2871
+
2872
+ CREATE TABLE "workflow_operation_records" (
2873
+ "id" text PRIMARY KEY NOT NULL,
2874
+ "team_id" text NOT NULL,
2875
+ "project_id" text,
2876
+ "name" text NOT NULL,
2877
+ "repository" text NOT NULL,
2878
+ "workflow_file" text NOT NULL,
2879
+ "secret_bearing" integer DEFAULT 0 NOT NULL,
2880
+ "trusted_execution_set_id" text NOT NULL,
2881
+ "dispatch_json" text DEFAULT '{}' NOT NULL,
2882
+ "inputs_json" text DEFAULT '[]' NOT NULL,
2883
+ "secret_classes_json" text DEFAULT '[]' NOT NULL,
2884
+ "status" text DEFAULT 'active' NOT NULL,
2885
+ "fail_closed_code" text,
2886
+ "metadata_json" text DEFAULT '{}' NOT NULL,
2887
+ "created_at" text NOT NULL,
2888
+ "updated_at" text NOT NULL,
2889
+ "blocked_at" text
2890
+ );
2891
+
2892
+ CREATE INDEX "idx_agent_capacity_plans_decision" ON "agent_capacity_plans" USING btree ("decision_id","status","created_at");
2893
+ CREATE INDEX "idx_agent_capacity_plans_project" ON "agent_capacity_plans" USING btree ("project_id","status","created_at");
2894
+ CREATE INDEX "idx_agent_capacity_plans_workday" ON "agent_capacity_plans" USING btree ("work_day_id","status","created_at");
2895
+ CREATE INDEX "idx_agent_mode_runs_assignment" ON "agent_mode_runs" USING btree ("provider_assignment_id","status");
2896
+ CREATE INDEX "idx_agent_mode_runs_project_mode" ON "agent_mode_runs" USING btree ("project_id","mode","created_at");
2897
+ CREATE INDEX "idx_agent_mode_runs_provider" ON "agent_mode_runs" USING btree ("capacity_provider_id","created_at");
2898
+ CREATE INDEX "idx_agent_pool_registrations_pool_heartbeat" ON "agent_pool_registrations" USING btree ("pool_id","heartbeat_at");
2899
+ CREATE INDEX "idx_agent_pool_scale_decisions_pool_created" ON "agent_pool_scale_decisions" USING btree ("pool_id","created_at");
2900
+ CREATE UNIQUE INDEX "idx_agent_pools_project_environment_name" ON "agent_pools" USING btree ("project_id","environment","name");
2901
+ CREATE INDEX "idx_api_tokens_user_id" ON "api_tokens" USING btree ("user_id");
2902
+ CREATE INDEX "idx_api_tokens_prefix" ON "api_tokens" USING btree ("token_prefix");
2903
+ CREATE INDEX "idx_approval_requests_team_state" ON "approval_requests" USING btree ("team_id","state","created_at");
2904
+ CREATE INDEX "idx_approval_requests_project_workday" ON "approval_requests" USING btree ("project_id","work_day_id","state","created_at");
2905
+ CREATE INDEX "idx_audit_events_target" ON "audit_events" USING btree ("target_type","target_id");
2906
+ CREATE INDEX "idx_auth_sessions_user_id" ON "auth_sessions" USING btree ("user_id");
2907
+ CREATE INDEX "idx_better_auth_account_userId" ON "better_auth_account" USING btree ("userId");
2908
+ CREATE UNIQUE INDEX "idx_better_auth_account_provider_account" ON "better_auth_account" USING btree ("providerId","accountId");
2909
+ CREATE INDEX "idx_better_auth_session_token" ON "better_auth_session" USING btree ("token");
2910
+ CREATE INDEX "idx_better_auth_session_userId" ON "better_auth_session" USING btree ("userId");
2911
+ CREATE UNIQUE INDEX "idx_better_auth_user_username" ON "better_auth_user" USING btree ("username");
2912
+ CREATE INDEX "idx_better_auth_verification_identifier" ON "better_auth_verification" USING btree ("identifier");
2913
+ CREATE INDEX "idx_capacity_allocation_sets_team_status" ON "capacity_allocation_sets" USING btree ("team_id","status","version");
2914
+ CREATE INDEX "idx_capacity_allocation_sets_team_created" ON "capacity_allocation_sets" USING btree ("team_id","created_at");
2915
+ CREATE INDEX "idx_capacity_grants_team_project" ON "capacity_grants" USING btree ("team_id","project_id","state");
2916
+ CREATE INDEX "idx_capacity_grants_provider_lane" ON "capacity_grants" USING btree ("capacity_provider_id","lane_id","state");
2917
+ CREATE INDEX "idx_capacity_ledger_project_workday_created" ON "capacity_ledger_entries" USING btree ("project_id","work_day_id","created_at");
2918
+ CREATE INDEX "idx_capacity_provider_api_keys_provider_status" ON "capacity_provider_api_keys" USING btree ("capacity_provider_id","status","created_at");
2919
+ CREATE INDEX "idx_capacity_provider_api_keys_prefix" ON "capacity_provider_api_keys" USING btree ("key_prefix");
2920
+ CREATE INDEX "idx_capacity_provider_deployments_provider_created" ON "capacity_provider_deployments" USING btree ("capacity_provider_id","created_at");
2921
+ CREATE UNIQUE INDEX "idx_capacity_provider_hosts_unique" ON "capacity_provider_hosts" USING btree ("capacity_provider_id","host_id","role");
2922
+ CREATE INDEX "idx_capacity_provider_lanes_provider" ON "capacity_provider_lanes" USING btree ("capacity_provider_id","business_model","scarcity_level");
2923
+ CREATE INDEX "idx_capacity_provider_registrations_provider_seen" ON "capacity_provider_registrations" USING btree ("capacity_provider_id","last_seen_at");
2924
+ CREATE INDEX "idx_capacity_providers_team_status" ON "capacity_providers" USING btree ("team_id","status","provider");
2925
+ CREATE INDEX "idx_capacity_reservations_project_workday_state" ON "capacity_reservations" USING btree ("project_id","work_day_id","state","created_at");
2926
+ CREATE INDEX "idx_capacity_reservations_provider_state" ON "capacity_reservations" USING btree ("capacity_provider_id","lane_id","state");
2927
+ CREATE INDEX "idx_capacity_reservations_execution_provider_state" ON "capacity_reservations" USING btree ("execution_provider_id","state","created_at");
2928
+ CREATE INDEX "idx_capacity_routing_decisions_project_workday" ON "capacity_routing_decisions" USING btree ("project_id","work_day_id","created_at");
2929
+ CREATE UNIQUE INDEX "idx_catalog_artifact_versions_item_version" ON "catalog_artifact_versions" USING btree ("item_id","version");
2930
+ CREATE INDEX "idx_catalog_artifact_versions_team_kind" ON "catalog_artifact_versions" USING btree ("team_id","kind","published_at");
2931
+ CREATE UNIQUE INDEX "idx_catalog_item_collaborators_subject_role" ON "catalog_item_collaborators" USING btree ("item_id","subject_type","subject_id","role");
2932
+ CREATE UNIQUE INDEX "idx_catalog_items_team_kind_slug" ON "catalog_items" USING btree ("team_id","kind","slug");
2933
+ CREATE INDEX "idx_catalog_items_team_kind" ON "catalog_items" USING btree ("team_id","kind","updated_at");
2934
+ CREATE INDEX "idx_catalog_items_visibility_listing" ON "catalog_items" USING btree ("visibility","listing_enabled","updated_at");
2935
+ CREATE INDEX "idx_client_encrypted_escrow_secret" ON "client_encrypted_escrow_records" USING btree ("secret_id","status");
2936
+ CREATE INDEX "idx_client_encrypted_escrow_project" ON "client_encrypted_escrow_records" USING btree ("team_id","project_id","status");
2937
+ CREATE UNIQUE INDEX "idx_commerce_buyer_stripe_customers_team" ON "commerce_buyer_stripe_customers" USING btree ("vendor_id","environment","buyer_team_id");
2938
+ CREATE UNIQUE INDEX "idx_commerce_buyer_stripe_customers_user" ON "commerce_buyer_stripe_customers" USING btree ("vendor_id","environment","buyer_user_id");
2939
+ CREATE UNIQUE INDEX "idx_commerce_buyer_stripe_customers_stripe" ON "commerce_buyer_stripe_customers" USING btree ("connected_account_id","stripe_customer_id");
2940
+ CREATE INDEX "idx_commerce_capacity_inquiries_listing_status" ON "commerce_capacity_listing_inquiries" USING btree ("listing_id","status","updated_at");
2941
+ CREATE INDEX "idx_commerce_capacity_inquiries_buyer_team" ON "commerce_capacity_listing_inquiries" USING btree ("buyer_team_id","status","updated_at");
2942
+ CREATE INDEX "idx_commerce_capacity_inquiries_buyer_user" ON "commerce_capacity_listing_inquiries" USING btree ("buyer_user_id","status","updated_at");
2943
+ CREATE INDEX "idx_commerce_capacity_inquiries_vendor_status" ON "commerce_capacity_listing_inquiries" USING btree ("vendor_id","status","updated_at");
2944
+ CREATE INDEX "idx_commerce_capacity_inquiries_seller_status" ON "commerce_capacity_listing_inquiries" USING btree ("seller_team_id","status","updated_at");
2945
+ CREATE INDEX "idx_commerce_capacity_inquiries_project" ON "commerce_capacity_listing_inquiries" USING btree ("related_project_id","status");
2946
+ CREATE INDEX "idx_commerce_capacity_inquiries_workday" ON "commerce_capacity_listing_inquiries" USING btree ("related_workday_id","status");
2947
+ CREATE UNIQUE INDEX "idx_commerce_capacity_listings_product" ON "commerce_capacity_listings" USING btree ("product_id");
2948
+ CREATE INDEX "idx_commerce_capacity_listings_vendor_status" ON "commerce_capacity_listings" USING btree ("vendor_id","status","updated_at");
2949
+ CREATE INDEX "idx_commerce_capacity_listings_seller_status" ON "commerce_capacity_listings" USING btree ("seller_team_id","status","updated_at");
2950
+ CREATE INDEX "idx_commerce_capacity_listings_provider_status" ON "commerce_capacity_listings" USING btree ("capacity_provider_id","status");
2951
+ CREATE INDEX "idx_commerce_capacity_listings_lane_status" ON "commerce_capacity_listings" USING btree ("capacity_provider_lane_id","status");
2952
+ CREATE INDEX "idx_commerce_capacity_listings_access_status" ON "commerce_capacity_listings" USING btree ("access_level","status","updated_at");
2953
+ CREATE INDEX "idx_commerce_cart_items_cart_status" ON "commerce_cart_items" USING btree ("cart_id","status");
2954
+ CREATE INDEX "idx_commerce_cart_items_vendor_status" ON "commerce_cart_items" USING btree ("vendor_id","status","updated_at");
2955
+ CREATE INDEX "idx_commerce_cart_items_offer" ON "commerce_cart_items" USING btree ("offer_id");
2956
+ CREATE INDEX "idx_commerce_cart_items_price" ON "commerce_cart_items" USING btree ("price_id");
2957
+ CREATE INDEX "idx_commerce_carts_buyer_team_status" ON "commerce_carts" USING btree ("buyer_team_id","status","updated_at");
2958
+ CREATE INDEX "idx_commerce_carts_buyer_user_status" ON "commerce_carts" USING btree ("buyer_user_id","status","updated_at");
2959
+ CREATE INDEX "idx_commerce_checkouts_cart" ON "commerce_checkouts" USING btree ("cart_id");
2960
+ CREATE INDEX "idx_commerce_checkouts_buyer_team_status" ON "commerce_checkouts" USING btree ("buyer_team_id","status","updated_at");
2961
+ CREATE INDEX "idx_commerce_checkouts_buyer_user_status" ON "commerce_checkouts" USING btree ("buyer_user_id","status","updated_at");
2962
+ CREATE INDEX "idx_commerce_contributions_product_effective" ON "commerce_contributions" USING btree ("product_id","effective_at");
2963
+ CREATE INDEX "idx_commerce_contributions_version_effective" ON "commerce_contributions" USING btree ("product_version_id","effective_at");
2964
+ CREATE INDEX "idx_commerce_contributions_contributor" ON "commerce_contributions" USING btree ("contributor_type","contributor_id");
2965
+ CREATE INDEX "idx_commerce_entitlements_buyer_team_status" ON "commerce_entitlements" USING btree ("buyer_team_id","status","updated_at");
2966
+ CREATE INDEX "idx_commerce_entitlements_buyer_user_status" ON "commerce_entitlements" USING btree ("buyer_user_id","status","updated_at");
2967
+ CREATE INDEX "idx_commerce_entitlements_product_status" ON "commerce_entitlements" USING btree ("product_id","status");
2968
+ CREATE INDEX "idx_commerce_entitlements_offer_status" ON "commerce_entitlements" USING btree ("offer_id","status");
2969
+ CREATE INDEX "idx_commerce_entitlements_order" ON "commerce_entitlements" USING btree ("order_id");
2970
+ CREATE INDEX "idx_commerce_entitlements_subscription" ON "commerce_entitlements" USING btree ("subscription_id");
2971
+ CREATE INDEX "idx_commerce_entitlements_catalog_item" ON "commerce_entitlements" USING btree ("catalog_item_id");
2972
+ CREATE INDEX "idx_commerce_fulfillment_events_order" ON "commerce_fulfillment_events" USING btree ("order_id","created_at");
2973
+ CREATE INDEX "idx_commerce_fulfillment_events_entitlement" ON "commerce_fulfillment_events" USING btree ("entitlement_id","created_at");
2974
+ CREATE INDEX "idx_commerce_fulfillment_events_vendor_status" ON "commerce_fulfillment_events" USING btree ("vendor_id","status","created_at");
2975
+ CREATE INDEX "idx_commerce_fulfillment_events_product" ON "commerce_fulfillment_events" USING btree ("product_id","created_at");
2976
+ CREATE INDEX "idx_commerce_governance_events_object" ON "commerce_governance_events" USING btree ("object_type","object_id","created_at");
2977
+ CREATE INDEX "idx_commerce_governance_events_product" ON "commerce_governance_events" USING btree ("related_product_id","created_at");
2978
+ CREATE INDEX "idx_commerce_governance_events_offer" ON "commerce_governance_events" USING btree ("related_offer_id","created_at");
2979
+ CREATE INDEX "idx_commerce_governance_events_team" ON "commerce_governance_events" USING btree ("related_team_id","created_at");
2980
+ CREATE INDEX "idx_commerce_governance_policies_product" ON "commerce_governance_policies" USING btree ("product_id","status");
2981
+ CREATE INDEX "idx_commerce_governance_policies_team" ON "commerce_governance_policies" USING btree ("team_id","policy_kind","status");
2982
+ CREATE INDEX "idx_commerce_offers_product_status" ON "commerce_offers" USING btree ("product_id","status","updated_at");
2983
+ CREATE INDEX "idx_commerce_offers_vendor_status" ON "commerce_offers" USING btree ("vendor_id","status","updated_at");
2984
+ CREATE INDEX "idx_commerce_offers_seller_status" ON "commerce_offers" USING btree ("seller_team_id","status","updated_at");
2985
+ CREATE INDEX "idx_commerce_offers_active_price" ON "commerce_offers" USING btree ("active_price_id");
2986
+ CREATE INDEX "idx_commerce_offers_stripe_product" ON "commerce_offers" USING btree ("stripe_product_id");
2987
+ CREATE INDEX "idx_commerce_offers_stripe_status" ON "commerce_offers" USING btree ("stripe_product_status","updated_at");
2988
+ CREATE INDEX "idx_commerce_order_items_order" ON "commerce_order_items" USING btree ("order_id");
2989
+ CREATE INDEX "idx_commerce_order_items_product_status" ON "commerce_order_items" USING btree ("product_id","status");
2990
+ CREATE INDEX "idx_commerce_order_items_offer_status" ON "commerce_order_items" USING btree ("offer_id","status");
2991
+ CREATE INDEX "idx_commerce_order_items_entitlement" ON "commerce_order_items" USING btree ("entitlement_id");
2992
+ CREATE INDEX "idx_commerce_orders_checkout" ON "commerce_orders" USING btree ("checkout_id");
2993
+ CREATE INDEX "idx_commerce_orders_buyer_team_status" ON "commerce_orders" USING btree ("buyer_team_id","status","updated_at");
2994
+ CREATE INDEX "idx_commerce_orders_buyer_user_status" ON "commerce_orders" USING btree ("buyer_user_id","status","updated_at");
2995
+ CREATE INDEX "idx_commerce_orders_vendor_status" ON "commerce_orders" USING btree ("vendor_id","status","updated_at");
2996
+ CREATE INDEX "idx_commerce_orders_stripe_payment_intent" ON "commerce_orders" USING btree ("stripe_payment_intent_id");
2997
+ CREATE INDEX "idx_commerce_orders_stripe_subscription" ON "commerce_orders" USING btree ("stripe_subscription_id");
2998
+ CREATE INDEX "idx_commerce_ownership_product_effective" ON "commerce_ownership_records" USING btree ("product_id","effective_at");
2999
+ CREATE INDEX "idx_commerce_ownership_seller_effective" ON "commerce_ownership_records" USING btree ("seller_team_id","effective_at");
3000
+ CREATE INDEX "idx_commerce_ownership_model_effective" ON "commerce_ownership_records" USING btree ("model","effective_at");
3001
+ CREATE INDEX "idx_commerce_ownership_transfers_product" ON "commerce_ownership_transfers" USING btree ("product_id","effective_at");
3002
+ CREATE INDEX "idx_commerce_ownership_transfers_product_status" ON "commerce_ownership_transfers" USING btree ("product_id","status","effective_at");
3003
+ CREATE INDEX "idx_commerce_ownership_transfers_from_status" ON "commerce_ownership_transfers" USING btree ("from_ownership_record_id","status");
3004
+ CREATE INDEX "idx_commerce_ownership_transfers_to_status" ON "commerce_ownership_transfers" USING btree ("to_ownership_record_id","status");
3005
+ CREATE INDEX "idx_commerce_payment_groups_checkout" ON "commerce_payment_groups" USING btree ("checkout_id");
3006
+ CREATE INDEX "idx_commerce_payment_groups_order" ON "commerce_payment_groups" USING btree ("order_id");
3007
+ CREATE INDEX "idx_commerce_payment_groups_vendor_status" ON "commerce_payment_groups" USING btree ("vendor_id","status","updated_at");
3008
+ CREATE INDEX "idx_commerce_payment_groups_payment_intent" ON "commerce_payment_groups" USING btree ("stripe_payment_intent_id");
3009
+ CREATE INDEX "idx_commerce_payment_groups_subscription" ON "commerce_payment_groups" USING btree ("stripe_subscription_id");
3010
+ CREATE UNIQUE INDEX "idx_commerce_prices_offer_version" ON "commerce_prices" USING btree ("offer_id","price_version");
3011
+ CREATE INDEX "idx_commerce_prices_offer_status" ON "commerce_prices" USING btree ("offer_id","status");
3012
+ CREATE INDEX "idx_commerce_prices_stripe_price" ON "commerce_prices" USING btree ("stripe_price_id");
3013
+ CREATE INDEX "idx_commerce_prices_stripe_sync_status" ON "commerce_prices" USING btree ("stripe_sync_status","updated_at");
3014
+ CREATE UNIQUE INDEX "idx_commerce_product_versions_product_version" ON "commerce_product_versions" USING btree ("product_id","version");
3015
+ CREATE INDEX "idx_commerce_product_versions_product_status" ON "commerce_product_versions" USING btree ("product_id","status","created_at");
3016
+ CREATE INDEX "idx_commerce_product_versions_catalog_artifact" ON "commerce_product_versions" USING btree ("catalog_artifact_version_id");
3017
+ CREATE UNIQUE INDEX "idx_commerce_products_team_kind_slug" ON "commerce_products" USING btree ("seller_team_id","kind","slug");
3018
+ CREATE INDEX "idx_commerce_products_vendor_status" ON "commerce_products" USING btree ("vendor_id","status","updated_at");
3019
+ CREATE INDEX "idx_commerce_products_catalog_item" ON "commerce_products" USING btree ("catalog_item_id");
3020
+ CREATE INDEX "idx_commerce_products_ownership_model" ON "commerce_products" USING btree ("ownership_model","updated_at");
3021
+ CREATE UNIQUE INDEX "idx_commerce_refunds_stripe" ON "commerce_refunds" USING btree ("stripe_refund_id","stripe_connected_account_id");
3022
+ CREATE UNIQUE INDEX "idx_commerce_refunds_idempotency" ON "commerce_refunds" USING btree ("idempotency_key");
3023
+ CREATE INDEX "idx_commerce_refunds_order" ON "commerce_refunds" USING btree ("order_id","created_at");
3024
+ CREATE INDEX "idx_commerce_refunds_vendor_status" ON "commerce_refunds" USING btree ("vendor_id","status","updated_at");
3025
+ CREATE INDEX "idx_commerce_refunds_seller_status" ON "commerce_refunds" USING btree ("seller_team_id","status","updated_at");
3026
+ CREATE UNIQUE INDEX "idx_commerce_service_contracts_request_quote" ON "commerce_service_contracts" USING btree ("request_id","quote_id");
3027
+ CREATE INDEX "idx_commerce_service_contracts_vendor" ON "commerce_service_contracts" USING btree ("vendor_id","status","updated_at");
3028
+ CREATE INDEX "idx_commerce_service_contracts_seller" ON "commerce_service_contracts" USING btree ("seller_team_id","status","updated_at");
3029
+ CREATE INDEX "idx_commerce_service_contracts_buyer_team" ON "commerce_service_contracts" USING btree ("buyer_team_id","status","updated_at");
3030
+ CREATE INDEX "idx_commerce_service_contracts_buyer_user" ON "commerce_service_contracts" USING btree ("buyer_user_id","status","updated_at");
3031
+ CREATE INDEX "idx_commerce_service_contracts_order" ON "commerce_service_contracts" USING btree ("order_id");
3032
+ CREATE INDEX "idx_commerce_service_contracts_entitlement" ON "commerce_service_contracts" USING btree ("entitlement_id");
3033
+ CREATE INDEX "idx_commerce_service_contracts_project" ON "commerce_service_contracts" USING btree ("related_project_id");
3034
+ CREATE INDEX "idx_commerce_service_contracts_workday" ON "commerce_service_contracts" USING btree ("related_workday_id");
3035
+ CREATE INDEX "idx_commerce_service_events_request" ON "commerce_service_events" USING btree ("request_id","created_at");
3036
+ CREATE INDEX "idx_commerce_service_events_quote" ON "commerce_service_events" USING btree ("quote_id","created_at");
3037
+ CREATE INDEX "idx_commerce_service_events_contract" ON "commerce_service_events" USING btree ("contract_id","created_at");
3038
+ CREATE INDEX "idx_commerce_service_events_type" ON "commerce_service_events" USING btree ("event_type","created_at");
3039
+ CREATE UNIQUE INDEX "idx_commerce_service_quotes_request_version" ON "commerce_service_quotes" USING btree ("request_id","quote_version");
3040
+ CREATE INDEX "idx_commerce_service_quotes_request" ON "commerce_service_quotes" USING btree ("request_id","status","updated_at");
3041
+ CREATE INDEX "idx_commerce_service_quotes_vendor" ON "commerce_service_quotes" USING btree ("vendor_id","status","updated_at");
3042
+ CREATE INDEX "idx_commerce_service_quotes_seller" ON "commerce_service_quotes" USING btree ("seller_team_id","status","updated_at");
3043
+ CREATE INDEX "idx_commerce_service_requests_buyer_team" ON "commerce_service_requests" USING btree ("buyer_team_id","status","updated_at");
3044
+ CREATE INDEX "idx_commerce_service_requests_buyer_user" ON "commerce_service_requests" USING btree ("buyer_user_id","status","updated_at");
3045
+ CREATE INDEX "idx_commerce_service_requests_vendor" ON "commerce_service_requests" USING btree ("vendor_id","status","updated_at");
3046
+ CREATE INDEX "idx_commerce_service_requests_seller" ON "commerce_service_requests" USING btree ("seller_team_id","status","updated_at");
3047
+ CREATE INDEX "idx_commerce_service_requests_offer" ON "commerce_service_requests" USING btree ("offer_id","status");
3048
+ CREATE INDEX "idx_commerce_service_requests_project" ON "commerce_service_requests" USING btree ("related_project_id","status");
3049
+ CREATE INDEX "idx_commerce_service_requests_workday" ON "commerce_service_requests" USING btree ("related_workday_id","status");
3050
+ CREATE INDEX "idx_commerce_stewards_product_role" ON "commerce_stewardship_assignments" USING btree ("product_id","role");
3051
+ CREATE INDEX "idx_commerce_stewards_ownership_role" ON "commerce_stewardship_assignments" USING btree ("ownership_record_id","role");
3052
+ CREATE INDEX "idx_commerce_stewards_assignee" ON "commerce_stewardship_assignments" USING btree ("assignee_type","assignee_id");
3053
+ CREATE UNIQUE INDEX "idx_commerce_subscriptions_stripe" ON "commerce_subscriptions" USING btree ("stripe_subscription_id","stripe_connected_account_id");
3054
+ CREATE INDEX "idx_commerce_subscriptions_buyer_team_status" ON "commerce_subscriptions" USING btree ("buyer_team_id","status","updated_at");
3055
+ CREATE INDEX "idx_commerce_subscriptions_vendor_status" ON "commerce_subscriptions" USING btree ("vendor_id","status","updated_at");
3056
+ CREATE INDEX "idx_commerce_subscriptions_offer_status" ON "commerce_subscriptions" USING btree ("offer_id","status");
3057
+ CREATE INDEX "idx_commerce_succession_events_product" ON "commerce_succession_events" USING btree ("product_id","event_type","created_at");
3058
+ CREATE INDEX "idx_commerce_succession_events_ownership" ON "commerce_succession_events" USING btree ("ownership_record_id","event_type");
3059
+ CREATE INDEX "idx_commerce_succession_events_successor" ON "commerce_succession_events" USING btree ("successor_type","successor_id");
3060
+ CREATE UNIQUE INDEX "idx_commerce_vendor_stripe_accounts_vendor_env" ON "commerce_vendor_stripe_accounts" USING btree ("vendor_id","environment");
3061
+ CREATE UNIQUE INDEX "idx_commerce_vendor_stripe_accounts_stripe_env" ON "commerce_vendor_stripe_accounts" USING btree ("stripe_account_id","environment");
3062
+ CREATE INDEX "idx_commerce_vendor_stripe_accounts_team_env" ON "commerce_vendor_stripe_accounts" USING btree ("team_id","environment");
3063
+ CREATE INDEX "idx_commerce_vendor_stripe_accounts_status" ON "commerce_vendor_stripe_accounts" USING btree ("account_status","updated_at");
3064
+ CREATE UNIQUE INDEX "idx_commerce_vendors_team_id" ON "commerce_vendors" USING btree ("team_id");
3065
+ CREATE UNIQUE INDEX "idx_commerce_vendors_slug" ON "commerce_vendors" USING btree ("slug");
3066
+ CREATE INDEX "idx_commerce_vendors_status" ON "commerce_vendors" USING btree ("status","updated_at");
3067
+ CREATE INDEX "idx_commerce_vendors_trust_level" ON "commerce_vendors" USING btree ("trust_level","updated_at");
3068
+ CREATE UNIQUE INDEX "idx_commerce_webhook_events_provider_event" ON "commerce_webhook_events" USING btree ("provider","environment","event_id");
3069
+ CREATE INDEX "idx_commerce_webhook_events_status_received" ON "commerce_webhook_events" USING btree ("status","received_at");
3070
+ CREATE INDEX "idx_commerce_webhook_events_connected_type" ON "commerce_webhook_events" USING btree ("connected_account_id","event_type","received_at");
3071
+ CREATE INDEX "idx_commerce_webhook_events_order" ON "commerce_webhook_events" USING btree ("related_order_id");
3072
+ CREATE INDEX "idx_commerce_webhook_events_subscription" ON "commerce_webhook_events" USING btree ("related_subscription_id");
3073
+ CREATE UNIQUE INDEX "idx_commons_decisions_proposal" ON "commons_decisions" USING btree ("proposal_id");
3074
+ CREATE INDEX "idx_commons_decisions_status" ON "commons_decisions" USING btree ("status","updated_at");
3075
+ CREATE UNIQUE INDEX "idx_commons_delegations_active" ON "commons_delegations" USING btree ("from_participant_id","to_participant_id","scope","status");
3076
+ CREATE INDEX "idx_commons_delegations_to" ON "commons_delegations" USING btree ("to_participant_id","status");
3077
+ CREATE INDEX "idx_commons_governance_events_proposal" ON "commons_governance_events" USING btree ("proposal_id","created_at");
3078
+ CREATE INDEX "idx_commons_governance_events_participant" ON "commons_governance_events" USING btree ("participant_id","created_at");
3079
+ CREATE INDEX "idx_commons_governance_events_type" ON "commons_governance_events" USING btree ("event_type","created_at");
3080
+ CREATE UNIQUE INDEX "idx_commons_participants_user" ON "commons_participants" USING btree ("user_id");
3081
+ CREATE INDEX "idx_commons_participants_team_status" ON "commons_participants" USING btree ("team_id","status","updated_at");
3082
+ CREATE UNIQUE INDEX "idx_commons_proposal_backings_once" ON "commons_proposal_backings" USING btree ("proposal_id","participant_id");
3083
+ CREATE INDEX "idx_commons_proposal_backings_proposal" ON "commons_proposal_backings" USING btree ("proposal_id","created_at");
3084
+ CREATE UNIQUE INDEX "idx_commons_proposal_votes_once" ON "commons_proposal_votes" USING btree ("proposal_id","participant_id");
3085
+ CREATE INDEX "idx_commons_proposal_votes_proposal" ON "commons_proposal_votes" USING btree ("proposal_id","vote","updated_at");
3086
+ CREATE INDEX "idx_commons_proposals_status" ON "commons_proposals" USING btree ("status","updated_at");
3087
+ CREATE INDEX "idx_commons_proposals_participant" ON "commons_proposals" USING btree ("participant_id","status","updated_at");
3088
+ CREATE INDEX "idx_commons_proposals_scope" ON "commons_proposals" USING btree ("scope","status","updated_at");
3089
+ CREATE INDEX "idx_commons_questions_status" ON "commons_questions" USING btree ("status","updated_at");
3090
+ CREATE INDEX "idx_commons_questions_participant" ON "commons_questions" USING btree ("participant_id","status","updated_at");
3091
+ CREATE INDEX "idx_commons_weight_snapshots_participant" ON "commons_weight_snapshots" USING btree ("participant_id","created_at");
3092
+ CREATE UNIQUE INDEX "idx_credit_conversion_profiles_profile_key" ON "credit_conversion_profiles" USING btree ("task_signature","execution_profile_id","execution_provider_kind","native_unit");
3093
+ CREATE INDEX "idx_credit_conversion_profiles_kind_unit" ON "credit_conversion_profiles" USING btree ("execution_provider_kind","native_unit","updated_at");
3094
+ CREATE INDEX "idx_cursor_state_updated" ON "cursor_state" USING btree ("updated_at");
3095
+ CREATE INDEX "idx_decision_execution_inputs_decision" ON "decision_execution_inputs" USING btree ("decision_id","status","created_at");
3096
+ CREATE INDEX "idx_decision_execution_inputs_project" ON "decision_execution_inputs" USING btree ("project_id","status","mode","created_at");
3097
+ CREATE UNIQUE INDEX "idx_decision_planning_statuses_decision" ON "decision_planning_statuses" USING btree ("decision_id");
3098
+ CREATE INDEX "idx_decision_planning_statuses_project" ON "decision_planning_statuses" USING btree ("project_id","execution_readiness","updated_at");
3099
+ CREATE UNIQUE INDEX "idx_entitlements_project" ON "entitlements" USING btree ("project_id");
3100
+ CREATE INDEX "idx_execution_provider_native_limits_provider_scope" ON "execution_provider_native_limits" USING btree ("execution_provider_id","scope","native_unit");
3101
+ CREATE INDEX "idx_execution_provider_observations_provider_observed" ON "execution_provider_observations" USING btree ("execution_provider_id","observed_at");
3102
+ CREATE INDEX "idx_execution_providers_team_status" ON "execution_providers" USING btree ("team_id","status","kind");
3103
+ CREATE INDEX "idx_execution_providers_capacity_provider" ON "execution_providers" USING btree ("capacity_provider_id","status");
3104
+ CREATE INDEX "idx_github_app_installations_team_status" ON "github_app_installation_records" USING btree ("team_id","status","updated_at");
3105
+ CREATE UNIQUE INDEX "idx_github_app_installations_team_installation" ON "github_app_installation_records" USING btree ("team_id","installation_id");
3106
+ CREATE INDEX "idx_github_app_token_issuance_project" ON "github_app_token_issuance_records" USING btree ("team_id","project_id","status","updated_at");
3107
+ CREATE INDEX "idx_github_app_token_issuance_operation" ON "github_app_token_issuance_records" USING btree ("operation_id","status","expires_at");
3108
+ CREATE INDEX "idx_github_app_token_issuance_assignment" ON "github_app_token_issuance_records" USING btree ("assignment_id","status","expires_at");
3109
+ CREATE INDEX "idx_github_repository_grants_project" ON "github_repository_grants" USING btree ("team_id","project_id","status");
3110
+ CREATE UNIQUE INDEX "idx_github_repository_grants_repository" ON "github_repository_grants" USING btree ("team_id","repository");
3111
+ CREATE UNIQUE INDEX "idx_hub_launch_events_launch_seq" ON "hub_launch_events" USING btree ("launch_id","seq");
3112
+ CREATE INDEX "idx_hub_launches_hub_created" ON "hub_launches" USING btree ("hub_id","created_at");
3113
+ CREATE UNIQUE INDEX "idx_hub_repositories_hub_role" ON "hub_repositories" USING btree ("hub_id","role");
3114
+ CREATE INDEX "idx_hub_workspace_links_hub" ON "hub_workspace_links" USING btree ("hub_id");
3115
+ CREATE INDEX "idx_knowledge_packs_team_id" ON "knowledge_packs" USING btree ("team_id");
3116
+ CREATE INDEX "idx_lease_state_status_expires" ON "lease_state" USING btree ("status","lease_expires_at");
3117
+ CREATE INDEX "idx_lease_state_claimed_by" ON "lease_state" USING btree ("claimed_by","updated_at");
3118
+ CREATE INDEX "idx_message_queue_claimable" ON "message_queue" USING btree ("status","available_at","priority");
3119
+ CREATE INDEX "idx_message_queue_related" ON "message_queue" USING btree ("related_model","related_id","created_at");
3120
+ CREATE INDEX "idx_native_usage_observations_profile" ON "native_usage_observations" USING btree ("project_id","task_signature","execution_profile_id","created_at");
3121
+ CREATE INDEX "idx_native_usage_observations_provider" ON "native_usage_observations" USING btree ("execution_provider_id","created_at");
3122
+ CREATE INDEX "idx_planning_input_requests_decision" ON "planning_input_requests" USING btree ("decision_id","status","requested_at");
3123
+ CREATE INDEX "idx_planning_input_requests_project" ON "planning_input_requests" USING btree ("project_id","status","requested_at");
3124
+ CREATE UNIQUE INDEX "idx_platform_operation_events_seq" ON "platform_operation_events" USING btree ("operation_id","seq");
3125
+ CREATE UNIQUE INDEX "idx_platform_operations_idempotency" ON "platform_operations" USING btree ("namespace","operation","idempotency_key");
3126
+ CREATE INDEX "idx_platform_operations_runnable" ON "platform_operations" USING btree ("status","created_at");
3127
+ CREATE UNIQUE INDEX "idx_platform_repository_claims_active" ON "platform_repository_claims" USING btree ("repository_key","runner_id");
3128
+ CREATE INDEX "idx_platform_repository_claims_runner" ON "platform_repository_claims" USING btree ("runner_id","claim_state");
3129
+ CREATE INDEX "idx_priority_overrides_project_priority" ON "priority_overrides" USING btree ("project_id","priority","updated_at");
3130
+ CREATE INDEX "idx_priority_snapshots_project_generated" ON "priority_snapshots" USING btree ("project_id","generated_at");
3131
+ CREATE UNIQUE INDEX "idx_project_agent_classes_project_slug" ON "project_agent_classes" USING btree ("project_id","slug");
3132
+ CREATE INDEX "idx_project_agent_classes_team_project" ON "project_agent_classes" USING btree ("team_id","project_id","status");
3133
+ CREATE UNIQUE INDEX "idx_project_capability_grants_project_operation" ON "project_capability_grants" USING btree ("project_id","namespace","operation");
3134
+ CREATE INDEX "idx_project_deployment_events_deployment_sequence" ON "project_deployment_events" USING btree ("deployment_id","sequence");
3135
+ CREATE INDEX "idx_project_deployment_events_project_created" ON "project_deployment_events" USING btree ("project_id","created_at");
3136
+ CREATE INDEX "idx_project_deployment_events_operation" ON "project_deployment_events" USING btree ("operation_id");
3137
+ CREATE INDEX "idx_project_deployments_project_created" ON "project_deployments" USING btree ("project_id","created_at");
3138
+ CREATE INDEX "idx_project_deployments_project_environment" ON "project_deployments" USING btree ("project_id","environment","created_at");
3139
+ CREATE INDEX "idx_project_deployments_project_status" ON "project_deployments" USING btree ("project_id","status","updated_at");
3140
+ CREATE INDEX "idx_project_deployments_operation" ON "project_deployments" USING btree ("platform_operation_id");
3141
+ CREATE INDEX "idx_project_deployments_team_created" ON "project_deployments" USING btree ("team_id","created_at");
3142
+ CREATE UNIQUE INDEX "idx_project_deployments_idempotency" ON "project_deployments" USING btree ("project_id","idempotency_key");
3143
+ CREATE UNIQUE INDEX "idx_project_environments_project_environment" ON "project_environments" USING btree ("project_id","environment");
3144
+ CREATE UNIQUE INDEX "idx_project_infrastructure_resource_unique" ON "project_infrastructure_resources" USING btree ("project_id","environment","provider","resource_kind","logical_name");
3145
+ CREATE INDEX "idx_project_summary_snapshots_team_generated" ON "project_summary_snapshots" USING btree ("team_id","generated_at");
3146
+ CREATE INDEX "idx_project_update_plans_hub" ON "project_update_plans" USING btree ("hub_id","created_at");
3147
+ CREATE INDEX "idx_project_workday_summaries_project_environment_created" ON "project_workday_summaries" USING btree ("project_id","environment","created_at");
3148
+ CREATE UNIQUE INDEX "idx_projects_team_slug" ON "projects" USING btree ("team_id","slug");
3149
+ CREATE INDEX "idx_projects_team_id" ON "projects" USING btree ("team_id");
3150
+ CREATE INDEX "idx_provider_assignments_provider_status" ON "provider_assignments" USING btree ("capacity_provider_id","status","lease_expires_at");
3151
+ CREATE INDEX "idx_provider_assignments_project_mode" ON "provider_assignments" USING btree ("project_id","mode","status");
3152
+ CREATE INDEX "idx_provider_assignments_lease" ON "provider_assignments" USING btree ("capacity_provider_id","lease_state","lease_expires_at");
3153
+ CREATE INDEX "idx_provider_assignments_runner" ON "provider_assignments" USING btree ("runner_id","lease_state");
3154
+ CREATE UNIQUE INDEX "idx_provider_assignments_synthesis_key" ON "provider_assignments" USING btree ("team_id","synthesis_key");
3155
+ CREATE INDEX "idx_provider_assignments_decision" ON "provider_assignments" USING btree ("decision_id","status");
3156
+ CREATE INDEX "idx_provider_assignments_team_created" ON "provider_assignments" USING btree ("team_id","created_at");
3157
+ CREATE INDEX "idx_provider_availability_sessions_provider_status" ON "provider_availability_sessions" USING btree ("capacity_provider_id","status","checked_in_at");
3158
+ CREATE INDEX "idx_provider_availability_sessions_team_status" ON "provider_availability_sessions" USING btree ("team_id","status","checked_in_at");
3159
+ CREATE INDEX "idx_provider_credential_sessions_team_host" ON "provider_credential_sessions" USING btree ("team_id","host_kind","host_id","status");
3160
+ CREATE INDEX "idx_provider_credential_sessions_job" ON "provider_credential_sessions" USING btree ("job_id","status");
3161
+ CREATE UNIQUE INDEX "idx_remote_job_events_job_seq" ON "remote_job_events" USING btree ("job_id","seq");
3162
+ CREATE INDEX "idx_remote_jobs_project_status" ON "remote_jobs" USING btree ("project_id","status","created_at");
3163
+ CREATE INDEX "idx_remote_jobs_project_idempotency" ON "remote_jobs" USING btree ("project_id","idempotency_key");
3164
+ CREATE UNIQUE INDEX "idx_repository_claims_runner_repo" ON "repository_claims" USING btree ("project_id","repository_id","runner_id");
3165
+ CREATE INDEX "idx_repository_claims_repo_state" ON "repository_claims" USING btree ("project_id","repository_id","claim_state","updated_at");
3166
+ CREATE INDEX "idx_repository_hosts_team_provider" ON "repository_hosts" USING btree ("team_id","provider","status");
3167
+ CREATE UNIQUE INDEX "idx_repository_hosts_team_provider_name" ON "repository_hosts" USING btree ("team_id","provider","name");
3168
+ CREATE UNIQUE INDEX "idx_repository_hosts_platform_provider_name" ON "repository_hosts" USING btree ("provider","name");
3169
+ CREATE INDEX "idx_runner_scale_decisions_project_workday" ON "runner_scale_decisions" USING btree ("project_id","environment","work_day_id","created_at");
3170
+ CREATE INDEX "idx_runtime_records_type_lookup_updated" ON "runtime_records" USING btree ("record_type","lookup_key","updated_at");
3171
+ CREATE INDEX "idx_runtime_records_type_status_updated" ON "runtime_records" USING btree ("record_type","status","updated_at");
3172
+ CREATE INDEX "idx_runtime_task_events_task_created" ON "runtime_task_events" USING btree ("task_id","created_at");
3173
+ CREATE INDEX "idx_runtime_task_outputs_task_created" ON "runtime_task_outputs" USING btree ("task_id","created_at");
3174
+ CREATE INDEX "idx_runtime_tasks_project_workday_state" ON "runtime_tasks" USING btree ("project_id","work_day_id","state","created_at");
3175
+ CREATE INDEX "idx_scale_decisions_project_environment_pool_created" ON "scale_decisions" USING btree ("project_id","environment","pool_name","created_at");
3176
+ CREATE INDEX "idx_secret_metadata_team_project" ON "secret_metadata_records" USING btree ("team_id","project_id","status");
3177
+ CREATE INDEX "idx_secret_metadata_custody" ON "secret_metadata_records" USING btree ("custody_mode","status");
3178
+ CREATE UNIQUE INDEX "idx_secret_metadata_team_name" ON "secret_metadata_records" USING btree ("team_id","project_id","name");
3179
+ CREATE INDEX "idx_seed_runs_seed_created" ON "seed_runs" USING btree ("seed_name","created_at");
3180
+ CREATE INDEX "idx_seed_runs_state_created" ON "seed_runs" USING btree ("state","created_at");
3181
+ CREATE INDEX "idx_task_credit_ledger_work_day_created" ON "task_credit_ledger" USING btree ("work_day_id","created_at");
3182
+ CREATE INDEX "idx_task_estimates_project_signature" ON "task_estimates" USING btree ("project_id","task_signature","created_at");
3183
+ CREATE INDEX "idx_task_estimates_project_signature_profile" ON "task_estimates" USING btree ("project_id","task_signature","execution_profile_id","created_at");
3184
+ CREATE INDEX "idx_task_usage_actuals_project_signature" ON "task_usage_actuals" USING btree ("project_id","task_signature","created_at");
3185
+ CREATE INDEX "idx_task_usage_actuals_project_signature_profile" ON "task_usage_actuals" USING btree ("project_id","task_signature","execution_profile_id","created_at");
3186
+ CREATE INDEX "idx_task_usage_actuals_execution_provider" ON "task_usage_actuals" USING btree ("execution_provider_id","created_at");
3187
+ CREATE INDEX "idx_team_api_keys_prefix" ON "team_api_keys" USING btree ("key_prefix");
3188
+ CREATE INDEX "idx_team_inbox_items_team_created" ON "team_inbox_items" USING btree ("team_id","created_at");
3189
+ CREATE INDEX "idx_team_invites_team_status" ON "team_invites" USING btree ("team_id","status","created_at");
3190
+ CREATE INDEX "idx_team_invites_token_prefix" ON "team_invites" USING btree ("token_prefix");
3191
+ CREATE UNIQUE INDEX "idx_team_memberships_team_user" ON "team_memberships" USING btree ("team_id","user_id");
3192
+ CREATE INDEX "idx_team_web_hosts_team_provider" ON "team_web_hosts" USING btree ("team_id","provider","status");
3193
+ CREATE UNIQUE INDEX "idx_team_web_hosts_team_provider_name" ON "team_web_hosts" USING btree ("team_id","provider","name");
3194
+ CREATE UNIQUE INDEX "idx_teams_name" ON "teams" USING btree ("name");
3195
+ CREATE INDEX "idx_treedx_credential_issuance_assignment" ON "treedx_credential_issuance_records" USING btree ("assignment_id","status","expires_at");
3196
+ CREATE INDEX "idx_treedx_credential_issuance_project" ON "treedx_credential_issuance_records" USING btree ("project_id","status","updated_at");
3197
+ CREATE INDEX "idx_treedx_deployments_team_instance" ON "treedx_deployments" USING btree ("team_id","instance_id","created_at");
3198
+ CREATE INDEX "idx_treedx_instances_team_status" ON "treedx_instances" USING btree ("team_id","status");
3199
+ CREATE INDEX "idx_treedx_mirrors_team_instance" ON "treedx_mirrors" USING btree ("team_id","instance_id");
3200
+ CREATE UNIQUE INDEX "idx_treedx_project_libraries_project" ON "treedx_project_libraries" USING btree ("project_id");
3201
+ CREATE INDEX "idx_treedx_project_libraries_instance" ON "treedx_project_libraries" USING btree ("instance_id");
3202
+ CREATE INDEX "idx_treedx_project_proxy_audit_project" ON "treedx_project_proxy_audit" USING btree ("project_id","created_at");
3203
+ CREATE INDEX "idx_treedx_project_proxy_audit_assignment" ON "treedx_project_proxy_audit" USING btree ("assignment_id","created_at");
3204
+ CREATE INDEX "idx_treedx_project_proxy_audit_result" ON "treedx_project_proxy_audit" USING btree ("project_id","result_status","created_at");
3205
+ CREATE INDEX "idx_treedx_proxy_handles_assignment" ON "treedx_proxy_handles" USING btree ("assignment_id","status","expires_at");
3206
+ CREATE INDEX "idx_treedx_proxy_handles_project" ON "treedx_proxy_handles" USING btree ("project_id","status","updated_at");
3207
+ CREATE INDEX "idx_treedx_shares_team_scope" ON "treedx_shares" USING btree ("team_id","scope","status");
3208
+ CREATE INDEX "idx_user_email_addresses_user" ON "user_email_addresses" USING btree ("user_id","status","is_primary");
3209
+ CREATE UNIQUE INDEX "idx_user_email_addresses_normalized" ON "user_email_addresses" USING btree ("normalized_email");
3210
+ CREATE UNIQUE INDEX "idx_user_identities_provider_subject" ON "user_identities" USING btree ("provider","provider_subject");
3211
+ CREATE UNIQUE INDEX "idx_user_role_bindings_user_role" ON "user_role_bindings" USING btree ("user_id","role_id");
3212
+ CREATE UNIQUE INDEX "idx_users_username" ON "users" USING btree ("username");
3213
+ CREATE INDEX "idx_web_sessions_user_id" ON "web_sessions" USING btree ("user_id");
3214
+ CREATE INDEX "idx_workday_capacity_envelopes_project_status" ON "workday_capacity_envelopes" USING btree ("project_id","status","created_at");
3215
+ CREATE INDEX "idx_workday_capacity_envelopes_team_status" ON "workday_capacity_envelopes" USING btree ("team_id","status","created_at");
3216
+ CREATE INDEX "idx_workday_manager_leases_active" ON "workday_manager_leases" USING btree ("project_id","environment","state","heartbeat_at");
3217
+ CREATE INDEX "idx_workday_requests_project_environment_state" ON "workday_requests" USING btree ("project_id","environment","state","created_at");
3218
+ CREATE UNIQUE INDEX "idx_worker_runners_identity" ON "worker_runners" USING btree ("project_id","environment","runner_id");
3219
+ CREATE INDEX "idx_worker_runners_state_capacity" ON "worker_runners" USING btree ("project_id","environment","state","available_capacity");
3220
+ CREATE INDEX "idx_workflow_dispatch_records_operation" ON "workflow_dispatch_records" USING btree ("workflow_operation_id","status","created_at");
3221
+ CREATE INDEX "idx_workflow_dispatch_records_platform" ON "workflow_dispatch_records" USING btree ("platform_operation_id");
3222
+ CREATE INDEX "idx_workflow_operation_records_project" ON "workflow_operation_records" USING btree ("team_id","project_id","status");
3223
+ CREATE UNIQUE INDEX "idx_workflow_operation_records_operation" ON "workflow_operation_records" USING btree ("team_id","id");