@vrplatform/kysely 1.3.45-4444 → 1.3.45-44494530923

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 (350) hide show
  1. package/build/.data.tar +2 -2
  2. package/build/main/camel-case/index.d.ts +4 -4
  3. package/build/main/camel-case/index.js +3 -2
  4. package/build/main/camel-case/index.js.map +1 -1
  5. package/build/main/connect-handoff.d.ts +12 -0
  6. package/build/main/connect-handoff.js +73 -0
  7. package/build/main/connect-handoff.js.map +1 -0
  8. package/build/main/control-plane/index.d.ts +421 -14
  9. package/build/main/control-plane/index.js +71 -0
  10. package/build/main/control-plane/index.js.map +1 -1
  11. package/build/main/domain.d.ts +4 -0
  12. package/build/main/domain.js +3 -0
  13. package/build/main/domain.js.map +1 -0
  14. package/build/main/error.d.ts +2 -1
  15. package/build/main/error.js +2 -1
  16. package/build/main/error.js.map +1 -1
  17. package/build/main/index.d.ts +57 -15
  18. package/build/main/index.js +498 -66
  19. package/build/main/index.js.map +1 -1
  20. package/build/main/isomorphic.d.ts +6 -6
  21. package/build/main/isomorphic.js +4 -8
  22. package/build/main/isomorphic.js.map +1 -1
  23. package/build/main/local/digest.d.ts +3 -3
  24. package/build/main/local/digest.js.map +1 -1
  25. package/build/main/local/generate.js +15 -13
  26. package/build/main/local/generate.js.map +1 -1
  27. package/build/main/local/index.d.ts +5 -1
  28. package/build/main/local/index.js +346 -12
  29. package/build/main/local/index.js.map +1 -1
  30. package/build/main/local/prune-pulled-schema.js +4 -1
  31. package/build/main/local/prune-pulled-schema.js.map +1 -1
  32. package/build/main/migration-source.d.ts +4 -0
  33. package/build/main/migration-source.js +45 -0
  34. package/build/main/migration-source.js.map +1 -0
  35. package/build/main/migration.d.ts +7 -0
  36. package/build/main/migration.js +11 -0
  37. package/build/main/migration.js.map +1 -0
  38. package/build/main/pganalyze-comment-plugin/comment-transformer.js +3 -1
  39. package/build/main/pganalyze-comment-plugin/comment-transformer.js.map +1 -1
  40. package/build/main/pganalyze-comment-plugin/index.js.map +1 -1
  41. package/build/main/plugins.d.ts +2 -2
  42. package/build/main/plugins.js.map +1 -1
  43. package/build/main/postgres-error.d.ts +9 -0
  44. package/build/main/postgres-error.js +28 -0
  45. package/build/main/postgres-error.js.map +1 -0
  46. package/build/main/query/index.d.ts +1 -0
  47. package/build/main/query/index.js +1 -0
  48. package/build/main/query/index.js.map +1 -1
  49. package/build/main/query/listing/status.d.ts +2 -12
  50. package/build/main/query/listing/status.js +35 -20
  51. package/build/main/query/listing/status.js.map +1 -1
  52. package/build/main/query/tenant/billing-partner.d.ts +4 -0
  53. package/build/main/query/tenant/billing-partner.js +8 -0
  54. package/build/main/query/tenant/billing-partner.js.map +1 -0
  55. package/build/main/query/tenant/feature-enabled.d.ts +6 -0
  56. package/build/main/query/tenant/feature-enabled.js +30 -0
  57. package/build/main/query/tenant/feature-enabled.js.map +1 -0
  58. package/build/main/query/tenant/index.d.ts +4 -0
  59. package/build/main/query/tenant/index.js +21 -0
  60. package/build/main/query/tenant/index.js.map +1 -0
  61. package/build/main/query/tenant/status.d.ts +9 -0
  62. package/build/main/query/tenant/status.js +32 -0
  63. package/build/main/query/tenant/status.js.map +1 -0
  64. package/build/main/query/tenant/where-uuid-in.d.ts +2 -0
  65. package/build/main/query/tenant/where-uuid-in.js +14 -0
  66. package/build/main/query/tenant/where-uuid-in.js.map +1 -0
  67. package/build/main/regional.d.ts +31 -4
  68. package/build/main/regional.js +69 -8
  69. package/build/main/regional.js.map +1 -1
  70. package/build/main/test/index.d.ts +21 -11
  71. package/build/main/test/index.js +31 -26
  72. package/build/main/test/index.js.map +1 -1
  73. package/build/main/transaction.d.ts +3 -3
  74. package/build/main/transaction.js.map +1 -1
  75. package/build/main/v1.generated.d.ts +1407 -177
  76. package/build/main/v1.generated.js.map +1 -1
  77. package/build/migrations-v2/0000000000000-baseline.ts +5 -0
  78. package/build/migrations-v2/0000000000001-public-audit-events-v2.ts +137 -0
  79. package/build/migrations-v2/0000000000002-audit-recovery-watermarks.ts +30 -0
  80. package/build/migrations-v2/0000000000003-audit-effect-recovery-watermark.ts +13 -0
  81. package/build/migrations-v2/0000000000004-audit-event-projected-at.ts +15 -0
  82. package/build/migrations-v2/0000000000005-audit-recovery-indexes.ts +63 -0
  83. package/build/migrations-v2/0000000000006-audit-action-public-event-projected-at.ts +22 -0
  84. package/build/migrations-v2/0000000000007-audit-action-public-event-projected-at-backfill.ts +35 -0
  85. package/build/migrations-v2/0000000000008-global-user-attribution.ts +33 -0
  86. package/build/migrations-v2/0000000000008-team-issue-rule-state.ts +52 -0
  87. package/build/migrations-v2/0000000000009-reservation-issue-projections.ts +45 -0
  88. package/build/migrations-v2/0000000000010-bank-rule-application-bank-record-delete-cascade.ts +26 -0
  89. package/build/migrations-v2/0000000000011-guest-balance-journal-entry-lookup-index.ts +25 -0
  90. package/build/migrations-v2/0000000000012-trial-free-analytics-billing-status.ts +72 -0
  91. package/build/migrations-v2/0000000000013-ui-permission-bundles.ts +45 -0
  92. package/build/migrations-v2/0000000000014-ui-permission-bundle-top-up.ts +32 -0
  93. package/build/migrations-v2/0000000000015-durable-flow-events.ts +163 -0
  94. package/build/migrations-v2/0000000000016-billing-listing-facts.ts +539 -0
  95. package/build/migrations-v2/0000000000016-managed-team-access.ts +34 -0
  96. package/build/migrations-v2/0000000000017-drop-trial-until.ts +42 -0
  97. package/build/migrations-v2/0000000000017-webhook-secret-reencryption-failures.ts +18 -0
  98. package/build/migrations-v2/0000000000018-accounting-integrity-monitoring.ts +276 -0
  99. package/build/migrations-v2/0000000000018-durable-flow-event-sensitive-input.ts +28 -0
  100. package/build/migrations-v2/0000000000019-accounting-integrity-run-shards.ts +26 -0
  101. package/build/migrations-v2/0000000000019-asynchronous-operations.ts +736 -0
  102. package/build/migrations-v2/0000000000020-accounting-integrity-case-classification.ts +52 -0
  103. package/build/migrations-v2/0000000000021-payment-line-classification-monitor-indexes.ts +31 -0
  104. package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
  105. package/build/migrations-v2/0000000000023-line-classification-usage.ts +325 -0
  106. package/build/migrations-v2/0000000000024-tenant-region-migration.ts +108 -0
  107. package/build/migrations-v2/0000000000025-partner-ach-denial-default.ts +30 -0
  108. package/build/migrations-v2/0000000000026-line-classification-usage-capture.ts +399 -0
  109. package/build/migrations-v2/0000000000027-payout-replacement-chain.ts +27 -0
  110. package/build/migrations-v2/0000000000028-accounting-integrity-operator-workflow.ts +108 -0
  111. package/build/migrations-v2/0000000000029-accounting-integrity-definition-artifacts.ts +40 -0
  112. package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts +49 -0
  113. package/build/migrations-v2/0000000000031-ui-permission-role-simplification.ts +70 -0
  114. package/build/migrations-v2/0000000000032-tenant-delete-ownership-cascades.ts +44 -0
  115. package/build/migrations-v2/0000000000033-plaid-connect-session-telemetry.ts +31 -0
  116. package/build/migrations-v2/0000000000033-reservation-issue-seed-bucket-index.ts +19 -0
  117. package/build/migrations-v2/0000000000034-retire-recent-classification-indexes.ts +29 -0
  118. package/build/migrations-v2/0000000000035-core-change-autovacuum.ts +24 -0
  119. package/build/migrations-v2/0000000000036-journal-entry-inactive-reason-constraint.ts +33 -0
  120. package/build/migrations-v2/0000000000037-journal-entry-inactive-reasons.ts +19 -0
  121. package/build/{migrations/0000000000023-journal-entry-currency-mismatch-reason.ts → migrations-v2/0000000000038-journal-entry-group-inactive-reason.ts} +4 -4
  122. package/build/migrations-v2/0000000000039-reservation-guest-breakdown.ts +19 -0
  123. package/build/migrations-v2/0000000000040-csv-import-source-identity-index.ts +23 -0
  124. package/build/migrations-v2/0000000000041-payment-returns.ts +38 -0
  125. package/build/migrations-v2/0000000000042-operation-resource-types.ts +609 -0
  126. package/build/migrations-v2/0000000000043-reservation-journal-freshness.ts +149 -0
  127. package/build/migrations-v2/0000000000044-reservation-journal-freshness-backfill.ts +254 -0
  128. package/build/migrations-v2/0000000000045-reservation-journal-freshness-revision-repair.ts +83 -0
  129. package/build/migrations-v2/0000000000046-materialized-reservation-journal-operations.ts +709 -0
  130. package/build/migrations-v2/0000000000047-public-audit-completion.ts +77 -0
  131. package/build/migrations-v2/0000000000048-reservation-journal-full-refresh-repair.ts +136 -0
  132. package/build/migrations-v2/0000000000049-queued-journal-operation-failures.ts +60 -0
  133. package/build/migrations-v2/0000000000050-connection-oauth-state.ts +43 -0
  134. package/build/migrations-v2/0000000000051-owner-statement-email-delivery.ts +134 -0
  135. package/build/migrations-v2/0000000000052-fee-journal-lock-skip-operations.ts +59 -0
  136. package/build/migrations-v2/0000000000053-fee-journal-lock-skip-null-attempt.ts +44 -0
  137. package/build/migrations-v2/0000000000054-journal-refresh-issue-codes.ts +16 -0
  138. package/build/migrations-v2/0000000000055-tenant-billing-subscription.ts +8 -0
  139. package/build/migrations-v2/0000000000056-journal-operation-failure-precedence.ts +306 -0
  140. package/build/migrations-v2/0000000000057-journal-invalidation-failure-code.ts +28 -0
  141. package/build/migrations-v2/0000000000058-journal-invalidation-locked-failure.ts +16 -0
  142. package/build/migrations-v2/0000000000059-billing-active-listing-cross-region-partner.ts +135 -0
  143. package/build/migrations-v2/0000000000060-accounting-integrity-change-driven.ts +99 -0
  144. package/build/migrations-v2/0000000000061-tenant-pending-onboarding-status.ts +37 -0
  145. package/build/migrations-v2/0000000000062-statement-payout-operations.ts +16 -0
  146. package/build/migrations-v2/0000000000063-missing-account-assignments-issue-code.ts +13 -0
  147. package/build/migrations-v2/0000000000064-journal-invalidation-source-lookup-index.ts +26 -0
  148. package/build/migrations-v2/0000000000065-hasura-connection-event-credentials.ts +42 -0
  149. package/build/migrations-v2/0000000000066-recurring-fee-listing-subscription-match-by.ts +51 -0
  150. package/build/migrations-v2/0000000000067-connection-credential-metadata.ts +60 -0
  151. package/build/migrations-v2/0000000000068-connection-credential-version.ts +34 -0
  152. package/build/migrations-v2/0000000000069-owner-statement-contact-email-delivery.ts +84 -0
  153. package/build/migrations-v2/0000000000070-payment-writer-compatibility.ts +69 -0
  154. package/build/migrations-v2/0000000000071-payments.ts +532 -0
  155. package/build/migrations-v2/0000000000072-journal-entry-payment-index.ts +21 -0
  156. package/build/migrations-v2/0000000000073-batch-invalidation-operation-registration.ts +74 -0
  157. package/build/migrations-v2/0000000000074-owner-statement-email-history.ts +34 -0
  158. package/build/migrations-v2/0000000000075-tenant-deletion-lookup-indexes.ts +46 -0
  159. package/build/migrations-v2/0000000000076-tenant-onboarding-not-null.ts +23 -0
  160. package/build/migrations-v2/0000000000077-payment-writer-statement-attachment.ts +92 -0
  161. package/build/migrations-v2/0000000000078-trigger-timeout-indexes.ts +44 -0
  162. package/build/migrations-v2/0000000000079-core-change-tenant-statistics.ts +26 -0
  163. package/build/migrations-v2/0000000000080-drop-legacy-tracking-event.ts +60 -0
  164. package/build/migrations-v2/0000000000081-recurring-fee-planner-operation-status.ts +35 -0
  165. package/build/migrations-v2/0000000000082-reservation-search-trigram-indexes.ts +54 -0
  166. package/build/migrations-v2/0000000000083-journal-entry-deposit-lookup-index.ts +31 -0
  167. package/build/migrations-v2/0000000000084-journal-entry-reservation-revenue-indexes.ts +57 -0
  168. package/build/migrations-v2/0000000000085-owner-statement-link-email-template.ts +23 -0
  169. package/build/migrations-v2/0000000000086-contact-payment-setup.ts +72 -0
  170. package/build/migrations-v2/0000000000087-address-delete-fk-indexes.ts +30 -0
  171. package/build/migrations-v2/0000000000088-owner-statement-email-switch.ts +76 -0
  172. package/build/migrations-v2/0000000000089-contact-bank-details-requested-at.ts +21 -0
  173. package/build/migrations-v2/0000000000090-contact-bank-account-api-key.ts +22 -0
  174. package/build/migrations-v2/0000000000091-contact-bank-details-request.ts +78 -0
  175. package/build/migrations-v2/0000000000092-payment-provider-reference.ts +22 -0
  176. package/build/migrations-v2/0000000000093-payment-reversal-offline-undo.ts +18 -0
  177. package/build/migrations-v2/0000000000094-reservation-status-checkout-index.ts +37 -0
  178. package/build/migrations-v2/0000000000095-payment-batches.ts +196 -0
  179. package/build/migrations-v2/0000000000096-guide-ongoing-tasks-issue-codes.ts +26 -0
  180. package/build/migrations-v2/0000000000097-reservation-line-mapping-suggestions.ts +53 -0
  181. package/build/migrations-v2/0000000000098-cancelled-reservation-balances-issue-code.ts +13 -0
  182. package/build/migrations-v2/0000000000099-contact-bank-account-request-source.ts +28 -0
  183. package/build/migrations-v2/0000000000100-drop-regional-feature-flags.ts +105 -0
  184. package/build/migrations-v2/0000000000101-bank-record-match-source.ts +45 -0
  185. package/build/migrations-v2/0000000000102-owner-statement-email-one-template.ts +63 -0
  186. package/build/migrations-v2/0000000000103-reservation-line-mapping-update-operation.ts +10 -0
  187. package/build/migrations-v2/0000000000104-export-job-payment-batch-pdf.ts +12 -0
  188. package/build/migrations-v2/0000000000105-drop-regional-token.ts +60 -0
  189. package/build/migrations-v2/0000000000106-incremental-audit-action-source.ts +158 -0
  190. package/build/migrations-v2/0000000000107-audit-mutation-transaction-insert-index.ts +44 -0
  191. package/build/migrations-v2/0000000000108-reservation-stay-type.ts +24 -0
  192. package/build/migrations-v2/0000000000109-long-term-liabilities-category-order.ts +21 -0
  193. package/build/migrations-v2/0000000000110-pms-sync-failures-issue-code.ts +13 -0
  194. package/build/migrations-v2/0000000000110-reservation-line-type-taxable.ts +21 -0
  195. package/build/migrations-v2/0000000000111-reservation-line-type-suggestion-taxable.ts +20 -0
  196. package/build/migrations-v2/0000000000112-contact-payment-method-outside-default.ts +44 -0
  197. package/build/migrations-v2/0000000000113-merchant-fee-reference-assignment.ts +25 -0
  198. package/build/migrations-v2/0000000000114-recurring-fee-nights-filter.ts +32 -0
  199. package/build/migrations-v2/0000000000115-bank-records-with-suggested-rule-issue-code.ts +13 -0
  200. package/build/migrations-v2/0000000000116-guest-review.ts +45 -0
  201. package/build/migrations-v2/0000000000117-ramp-external-funding-accounts.ts +91 -0
  202. package/build/migrations-v2/0000000000118-pm-payout-assignment.ts +25 -0
  203. package/build/migrations-v2/0000000000119-chart-of-accounts-classifications.ts +46 -0
  204. package/build/migrations-v2/0000000000120-feedback.ts +41 -0
  205. package/build/migrations-v2/0000000000121-source-owner-block-calendar-index.ts +43 -0
  206. package/build/migrations-v2/0000000000122-recurring-fee-stay-types-filter.ts +20 -0
  207. package/build/migrations-v2/0000000000123-reservation-owner-stay-type-index.ts +40 -0
  208. package/build/migrations-v2/0000000000124-remove-tenant-test-and-billable-columns.ts +63 -0
  209. package/build/migrations-v2/0000000000125-ramp-application.ts +56 -0
  210. package/build/migrations-v2/0000000000126-advanced-deposits-update-operation.ts +10 -0
  211. package/build/migrations-v2/0000000000127-contact-1099-tax-details.ts +46 -0
  212. package/build/migrations-v2/0000000000128-tax-1099-email-templates.ts +36 -0
  213. package/build/migrations-v2/0000000000129-tenant-locked-at.ts +18 -0
  214. package/build/migrations-v2/0000000000130-second-factor-reset.ts +65 -0
  215. package/build/migrations-v2/0000000000131-payout-hold.ts +49 -0
  216. package/build/migrations-v2/0000000000132-member-invite-approval.ts +62 -0
  217. package/build/migrations-v2/0000000000133-audit-action-client-ip.ts +38 -0
  218. package/build/migrations-v2/0000000000134-drop-orphaned-hasura-triggers.ts +39 -0
  219. package/build/migrations-v2/0000000000135-drop-orphaned-hasura-triggers-literal.ts +42 -0
  220. package/build/migrations-v2/0000000000136-drop-all-hasura-triggers.ts +43 -0
  221. package/build/migrations-v2/0000000000137-webhook-event.ts +57 -0
  222. package/build/migrations-v2/0000000000138-contact-tax-details-requested-at.ts +24 -0
  223. package/build/migrations-v2/0000000000139-tax-statement-1099.ts +140 -0
  224. package/build/migrations-v2/0000000000140-owner-payment-settings.ts +53 -0
  225. package/build/migrations-v2/0000000000141-owner-payment-requests.ts +100 -0
  226. package/build/migrations-v2/0000000000148-statement-level-operation-triggers.ts +229 -0
  227. package/build/migrations-v2/0000000000151-core-change-unused-indexes.ts +85 -0
  228. package/build/migrations-v2/0000000000154-accounting-integrity-backlog-performance.ts +68 -0
  229. package/build/migrations-v2/0000000000155-source-last-successful-hash.ts +23 -0
  230. package/build/module/camel-case/index.d.ts +4 -4
  231. package/build/module/camel-case/index.js +4 -3
  232. package/build/module/camel-case/index.js.map +1 -1
  233. package/build/module/connect-handoff.d.ts +12 -0
  234. package/build/module/connect-handoff.js +70 -0
  235. package/build/module/connect-handoff.js.map +1 -0
  236. package/build/module/control-plane/index.d.ts +421 -14
  237. package/build/module/control-plane/index.js +58 -1
  238. package/build/module/control-plane/index.js.map +1 -1
  239. package/build/module/domain.d.ts +4 -0
  240. package/build/module/domain.js +2 -0
  241. package/build/module/domain.js.map +1 -0
  242. package/build/module/error.d.ts +2 -1
  243. package/build/module/error.js +3 -1
  244. package/build/module/error.js.map +1 -1
  245. package/build/module/index.d.ts +57 -15
  246. package/build/module/index.js +496 -64
  247. package/build/module/index.js.map +1 -1
  248. package/build/module/isomorphic.d.ts +6 -6
  249. package/build/module/isomorphic.js +2 -7
  250. package/build/module/isomorphic.js.map +1 -1
  251. package/build/module/local/digest.d.ts +3 -3
  252. package/build/module/local/digest.js.map +1 -1
  253. package/build/module/local/generate.js +15 -13
  254. package/build/module/local/generate.js.map +1 -1
  255. package/build/module/local/index.d.ts +5 -1
  256. package/build/module/local/index.js +347 -13
  257. package/build/module/local/index.js.map +1 -1
  258. package/build/module/local/prune-pulled-schema.js +4 -1
  259. package/build/module/local/prune-pulled-schema.js.map +1 -1
  260. package/build/module/migration-source.d.ts +4 -0
  261. package/build/module/migration-source.js +42 -0
  262. package/build/module/migration-source.js.map +1 -0
  263. package/build/module/migration.d.ts +7 -0
  264. package/build/module/migration.js +8 -0
  265. package/build/module/migration.js.map +1 -0
  266. package/build/module/pganalyze-comment-plugin/comment-transformer.js +3 -1
  267. package/build/module/pganalyze-comment-plugin/comment-transformer.js.map +1 -1
  268. package/build/module/plugins.d.ts +2 -2
  269. package/build/module/plugins.js.map +1 -1
  270. package/build/module/postgres-error.d.ts +9 -0
  271. package/build/module/postgres-error.js +24 -0
  272. package/build/module/postgres-error.js.map +1 -0
  273. package/build/module/query/index.d.ts +1 -0
  274. package/build/module/query/index.js +1 -0
  275. package/build/module/query/index.js.map +1 -1
  276. package/build/module/query/listing/status.d.ts +2 -12
  277. package/build/module/query/listing/status.js +35 -18
  278. package/build/module/query/listing/status.js.map +1 -1
  279. package/build/module/query/tenant/billing-partner.d.ts +4 -0
  280. package/build/module/query/tenant/billing-partner.js +5 -0
  281. package/build/module/query/tenant/billing-partner.js.map +1 -0
  282. package/build/module/query/tenant/feature-enabled.d.ts +6 -0
  283. package/build/module/query/tenant/feature-enabled.js +27 -0
  284. package/build/module/query/tenant/feature-enabled.js.map +1 -0
  285. package/build/module/query/tenant/index.d.ts +4 -0
  286. package/build/module/query/tenant/index.js +5 -0
  287. package/build/module/query/tenant/index.js.map +1 -0
  288. package/build/module/query/tenant/status.d.ts +9 -0
  289. package/build/module/query/tenant/status.js +28 -0
  290. package/build/module/query/tenant/status.js.map +1 -0
  291. package/build/module/query/tenant/where-uuid-in.d.ts +2 -0
  292. package/build/module/query/tenant/where-uuid-in.js +11 -0
  293. package/build/module/query/tenant/where-uuid-in.js.map +1 -0
  294. package/build/module/regional.d.ts +31 -4
  295. package/build/module/regional.js +68 -8
  296. package/build/module/regional.js.map +1 -1
  297. package/build/module/test/index.d.ts +21 -11
  298. package/build/module/test/index.js +31 -26
  299. package/build/module/test/index.js.map +1 -1
  300. package/build/module/transaction.d.ts +3 -3
  301. package/build/module/transaction.js.map +1 -1
  302. package/build/module/v1.generated.d.ts +1407 -177
  303. package/build/module/v1.generated.js.map +1 -1
  304. package/package.json +19 -16
  305. package/build/migrations/0000000000001-init.ts +0 -5
  306. package/build/migrations/0000000000009-drop-store-schema.ts +0 -14
  307. package/build/migrations/0000000000010-bank-rules.ts +0 -190
  308. package/build/migrations/0000000000011-bank-rule-line-adjustments.ts +0 -65
  309. package/build/migrations/0000000000012-bank-rule-conditions.ts +0 -45
  310. package/build/migrations/0000000000013-bank-rule-name-unique.ts +0 -15
  311. package/build/migrations/0000000000014-bank-rule-drop-legacy-conditions.ts +0 -41
  312. package/build/migrations/0000000000015-booking-channel-logo-dev-provider.ts +0 -70
  313. package/build/migrations/0000000000016-owner-statement-draft-status.ts +0 -22
  314. package/build/migrations/0000000000017-tenant-migration-markers.ts +0 -18
  315. package/build/migrations/0000000000018-security-deposits-payable-category.ts +0 -63
  316. package/build/migrations/0000000000019-tenant-app-settings.ts +0 -76
  317. package/build/migrations/0000000000020-operating-opening-trial-balance.ts +0 -36
  318. package/build/migrations/0000000000021-audit-foreign-key-indexes.ts +0 -77
  319. package/build/migrations/0000000000022-opening-trial-balance-combined-columns.ts +0 -30
  320. package/build/migrations/0000000000024-listing-parent.ts +0 -37
  321. package/build/migrations/0000000000025-journal-entry-parent-listing.ts +0 -26
  322. package/build/migrations/0000000000026-booking-channel-logo-slots.ts +0 -89
  323. package/build/migrations/0000000000027-list-browse-performance-indexes.ts +0 -52
  324. package/build/migrations/0000000000028-flow-setting-status-jsonb.ts +0 -20
  325. package/build/migrations/0000000000029-tenant-slug.ts +0 -328
  326. package/build/migrations/0000000000030-pms-accounting-windows.ts +0 -50
  327. package/build/migrations/0000000000031-owner-statement-projection-listing-revision.ts +0 -20
  328. package/build/migrations/0000000000032-flow-event-listening.ts +0 -28
  329. package/build/migrations/0000000000033-opening-trial-balance-transaction.ts +0 -272
  330. package/build/migrations/0000000000034-historic-general-ledger.ts +0 -24
  331. package/build/migrations/0000000000035-tenant-regional-placement.ts +0 -37
  332. package/build/migrations/0000000000036-control-plane-projection-events.ts +0 -43
  333. package/build/migrations/0000000000037-tenant-guide-onboarding.ts +0 -21
  334. package/build/migrations/0000000000038-tracking-event-analytics-sink.ts +0 -31
  335. package/build/migrations/0000000000039-crunchy-region.ts +0 -86
  336. package/build/migrations/0000000000040-hostaway-region.ts +0 -72
  337. package/build/migrations/0000000000041-audit-tenant-fk.ts +0 -66
  338. package/build/migrations/0000000000042-ramp-staging-connect-params.ts +0 -35
  339. package/build/migrations/0000000000043-gl-pms-accounting-window-guard.ts +0 -125
  340. package/build/migrations/0000000000044-tenant-cross-region-fks.ts +0 -45
  341. package/build/migrations/0000000000045-cloudflare-region-env.ts +0 -100
  342. package/build/migrations/0000000000046-control-plane-outbox-alias.ts +0 -46
  343. package/build/migrations/0000000000047-ramp-contact-last-4-digits.ts +0 -16
  344. package/build/migrations/0000000000047-tenant-status-backfill.ts +0 -40
  345. package/build/migrations/0000000000048-tenant-status-constraint.ts +0 -24
  346. package/build/migrations/0000000000049-health-tenant-issues.ts +0 -69
  347. package/build/migrations/0000000000050-partner-webhooks.ts +0 -135
  348. package/build/migrations/0000000000051-health-webhook-runtime-grants.ts +0 -42
  349. package/build/migrations/0000000000052-feature-approval-team-enablement.ts +0 -13
  350. package/build/migrations/0000000000053-health-webhook-enums.ts +0 -296
@@ -0,0 +1,105 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19721: feature flags are read from the control plane only. The regional
5
+ // copy and its catalog have no reader or writer left, so they are dropped
6
+ // without cascade: a missed dependency fails the migration.
7
+ export async function up(db: Kysely<unknown>): Promise<void> {
8
+ await sql`set local lock_timeout = '5s'`.execute(db);
9
+ await sql`set local statement_timeout = '60s'`.execute(db);
10
+
11
+ await sql`drop table public.feature_enabled_team`.execute(db);
12
+ await sql`drop table public.feature_approval`.execute(db);
13
+ await sql`drop table public.feature`.execute(db);
14
+ await sql`drop table public.feature_approval_status`.execute(db);
15
+ await sql`drop table public.feature_status`.execute(db);
16
+ await sql`
17
+ delete from public.control_plane_projection_event
18
+ where aggregate_type = 'feature'
19
+ `.execute(db);
20
+ }
21
+
22
+ // Recreates the tables as the baseline defined them, with the status reference
23
+ // rows. Flag rows and projection history are not restored.
24
+ export async function down(db: Kysely<unknown>): Promise<void> {
25
+ await sql`
26
+ create table public.feature_status (name text primary key)
27
+ `.execute(db);
28
+ await sql`
29
+ create table public.feature_approval_status (name text primary key)
30
+ `.execute(db);
31
+ await sql`
32
+ insert into public.feature_status (name)
33
+ values ('deployed'), ('ready'), ('testing')
34
+ `.execute(db);
35
+ await sql`
36
+ insert into public.feature_approval_status (name)
37
+ values ('all'), ('disabled'), ('partially')
38
+ `.execute(db);
39
+ await sql`
40
+ create table public.feature (
41
+ id uuid primary key default gen_random_uuid(),
42
+ created_at timestamptz not null default now(),
43
+ updated_at timestamptz not null default now(),
44
+ title text not null,
45
+ url text,
46
+ description text,
47
+ issue_url text,
48
+ tenant_id uuid,
49
+ required_approvals jsonb default jsonb_build_array(),
50
+ status text default 'testing' references public.feature_status (name)
51
+ on update restrict on delete restrict,
52
+ constraint feature_required_approvals_array_check check (
53
+ required_approvals is null
54
+ or jsonb_typeof(required_approvals) = 'array'
55
+ )
56
+ )
57
+ `.execute(db);
58
+ await sql`
59
+ create table public.feature_approval (
60
+ id uuid primary key default gen_random_uuid(),
61
+ feature_id uuid not null references public.feature (id)
62
+ on update restrict on delete cascade,
63
+ user_id uuid not null references public."user" (id)
64
+ on update restrict on delete cascade,
65
+ created_at timestamptz not null default now(),
66
+ updated_at timestamptz not null default now(),
67
+ status text default 'disabled' references public.feature_approval_status (name)
68
+ on update restrict on delete restrict,
69
+ constraint feature_approval_feature_id_user_id_key unique (feature_id, user_id)
70
+ )
71
+ `.execute(db);
72
+ await sql`
73
+ create table public.feature_enabled_team (
74
+ id uuid primary key default gen_random_uuid(),
75
+ tenant_id uuid not null references public.tenant (id)
76
+ on update restrict on delete cascade,
77
+ feature_id uuid not null references public.feature (id)
78
+ on update restrict on delete cascade,
79
+ created_at timestamptz not null default now(),
80
+ updated_at timestamptz not null default now(),
81
+ status text default 'disabled' references public.feature_approval_status (name)
82
+ on update restrict on delete restrict,
83
+ constraint feature_enabled_team_tenant_id_feature_id_key
84
+ unique (tenant_id, feature_id)
85
+ )
86
+ `.execute(db);
87
+ await sql`create index feature_status_idx on public.feature (status)`.execute(
88
+ db
89
+ );
90
+ await sql`
91
+ create index feature_approval_status_idx on public.feature_approval (status)
92
+ `.execute(db);
93
+ await sql`
94
+ create index idx_feature_enabled_team_status
95
+ on public.feature_enabled_team (tenant_id, status)
96
+ where status = any (array['all', 'partially'])
97
+ `.execute(db);
98
+ for (const table of ['feature', 'feature_approval', 'feature_enabled_team']) {
99
+ await sql
100
+ .raw(
101
+ `create trigger set_public_${table}_updated_at before update on public.${table} for each row execute function set_current_timestamp_updated_at()`
102
+ )
103
+ .execute(db);
104
+ }
105
+ }
@@ -0,0 +1,45 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19733: record how each bank record was matched. Expand only: both columns are nullable
5
+ // and no writer needs them, so older deployments keep inserting matches with null (unknown).
6
+ // The table has about 150k rows in the largest region, so the constraint and index scans are
7
+ // sub-second under the lock timeouts below.
8
+ export async function up(db: Kysely<unknown>): Promise<void> {
9
+ await sql`set local lock_timeout = '5s'`.execute(db);
10
+ await sql`set local statement_timeout = '60s'`.execute(db);
11
+
12
+ await sql`
13
+ create type accounting.bank_record_match_source as enum (
14
+ 'manual', 'suggestion', 'rule', 'autoRule'
15
+ )
16
+ `.execute(db);
17
+ await sql`
18
+ alter table accounting.bank_record_transaction_payment
19
+ add column match_source accounting.bank_record_match_source null,
20
+ add column bank_rule_id uuid null
21
+ references accounting.bank_rule (id) on update restrict on delete set null,
22
+ add constraint bank_record_transaction_payment_bank_rule_source_check
23
+ check (bank_rule_id is null or match_source in ('rule', 'autoRule'))
24
+ `.execute(db);
25
+ await sql`
26
+ create index bank_record_transaction_payment_bank_rule_id_idx
27
+ on accounting.bank_record_transaction_payment (bank_rule_id)
28
+ where bank_rule_id is not null
29
+ `.execute(db);
30
+ }
31
+
32
+ export async function down(db: Kysely<unknown>): Promise<void> {
33
+ await sql`
34
+ drop index if exists accounting.bank_record_transaction_payment_bank_rule_id_idx
35
+ `.execute(db);
36
+ await sql`
37
+ alter table accounting.bank_record_transaction_payment
38
+ drop constraint if exists bank_record_transaction_payment_bank_rule_source_check,
39
+ drop column if exists bank_rule_id,
40
+ drop column if exists match_source
41
+ `.execute(db);
42
+ await sql`drop type if exists accounting.bank_record_match_source`.execute(
43
+ db
44
+ );
45
+ }
@@ -0,0 +1,63 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // VRT-795: owner contacts and viewers share one owner statement email,
5
+ // `ownerStatement_owner`. Teams have edited that template since 2024; the
6
+ // link template is the copy migration 088 made, and no team had edited it by
7
+ // 2026-10-22. So each team keeps its `ownerStatement_owner` text. A link
8
+ // template replaces it only where the team saved the link template after the
9
+ // copy and after its last viewer edit, or saved no viewer template. The
10
+ // no-login preview line that migration 088 wrote then takes the default that
11
+ // names no login, because viewers log in. Link rows stay until every
12
+ // deployment reads the one template; deployed code still reads them.
13
+ export async function up(db: Kysely<unknown>): Promise<void> {
14
+ await sql`set local lock_timeout = '5s'`.execute(db);
15
+ await sql`set local statement_timeout = '60s'`.execute(db);
16
+
17
+ await sql`
18
+ insert into public.email_template (tenant_id, type, data_json)
19
+ select
20
+ link.tenant_id,
21
+ 'ownerStatement_owner',
22
+ case
23
+ when link.data_json ->> 'shortDescription'
24
+ = 'Your owner statement is ready. Open it with one click, no login needed.'
25
+ then link.data_json || jsonb_build_object(
26
+ 'shortDescription',
27
+ 'Your owner statement is ready to view.'
28
+ )
29
+ else link.data_json
30
+ end
31
+ from public.email_template link
32
+ left join public.email_template viewer
33
+ on viewer.tenant_id = link.tenant_id
34
+ and viewer.type = 'ownerStatement_owner'
35
+ where link.type = 'ownerStatementLink_owner'
36
+ and (
37
+ viewer.id is null
38
+ or (
39
+ link.updated_at > link.created_at
40
+ and link.updated_at > viewer.updated_at
41
+ )
42
+ )
43
+ on conflict (tenant_id, type) do update
44
+ set data_json = excluded.data_json
45
+ `.execute(db);
46
+
47
+ // Most saved templates still carry the old default preview line, which
48
+ // tells owners to log in. Teams never edited it, so it takes the new
49
+ // default; preview lines teams wrote stay.
50
+ await sql`
51
+ update public.email_template
52
+ set data_json = data_json || jsonb_build_object(
53
+ 'shortDescription',
54
+ 'Your owner statement is ready to view.'
55
+ )
56
+ where type = 'ownerStatement_owner'
57
+ and data_json ->> 'shortDescription'
58
+ ~ '^An owner statement is ready for you\\. Log in to [^.]+ now to view it\\.\\s*$'
59
+ `.execute(db);
60
+ }
61
+
62
+ // Replaced viewer text is gone, and the kept text is team data by now.
63
+ export async function down(_db: Kysely<unknown>): Promise<void> {}
@@ -0,0 +1,10 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`alter type core.operation_type add value if not exists 'reservation-line-mapping-update'`.execute(
5
+ db
6
+ );
7
+ }
8
+
9
+ // PostgreSQL enum additions are retained so historical operations remain readable.
10
+ export async function down(_db: Kysely<unknown>): Promise<void> {}
@@ -0,0 +1,12 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ // Expand storage only: the Trigger task and the API producer ship after it.
6
+ await sql`alter type core.export_job_task_id add value if not exists 'api/export-payment-batch-pdf'`.execute(
7
+ db
8
+ );
9
+ }
10
+
11
+ // PostgreSQL enum additions are retained so historical export jobs stay readable.
12
+ export async function down(_db: Kysely<unknown>): Promise<void> {}
@@ -0,0 +1,60 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19885: authentication reads tokens only from control_plane.token. The
5
+ // regional table has no reader or writer left. Crunchy keeps its frozen copy:
6
+ // it is the only database that holds VRIntegrations teams, and the only one
7
+ // where the baseline partner is not the sole team with that realm. Dropped
8
+ // without cascade, so a missed dependency fails the migration.
9
+ export async function up(db: Kysely<unknown>): Promise<void> {
10
+ await sql`set local lock_timeout = '5s'`.execute(db);
11
+ await sql`set local statement_timeout = '60s'`.execute(db);
12
+
13
+ const holdsVrIntegrationTeams = await sql<{ holds: boolean }>`
14
+ select exists (
15
+ select 1
16
+ from public.tenant
17
+ where storage_realm = 'vrintegration'
18
+ and id <> 'd6ab2bbe-e0fc-48d9-89a3-c3c05f4e79b5'
19
+ ) as holds
20
+ `.execute(db);
21
+ if (holdsVrIntegrationTeams.rows[0]?.holds) return;
22
+
23
+ await sql`drop table public.token`.execute(db);
24
+ }
25
+
26
+ // Recreates the empty table as the baseline defined it. Rows are not restored.
27
+ export async function down(db: Kysely<unknown>): Promise<void> {
28
+ await sql`
29
+ create table if not exists public.token (
30
+ id text primary key default gen_random_uuid(),
31
+ payload jsonb not null default jsonb_build_object(),
32
+ created_at timestamptz not null default now(),
33
+ expires_at timestamptz,
34
+ type text,
35
+ nano_id text not null default gen_random_uuid(),
36
+ tenant_id uuid references public.tenant (id)
37
+ on update restrict on delete set null,
38
+ user_id uuid references public."user" (id)
39
+ on update restrict on delete set null
40
+ )
41
+ `.execute(db);
42
+ await sql`
43
+ create index if not exists token_id_type_idx on public.token (id, type)
44
+ `.execute(db);
45
+ await sql`
46
+ create index if not exists token_nano_id_idx on public.token (nano_id)
47
+ `.execute(db);
48
+ await sql`
49
+ create unique index if not exists token_partner_secret_unique_idx
50
+ on public.token (nano_id)
51
+ where type = any (array['partner_api_key', 'embedded_bootstrap'])
52
+ `.execute(db);
53
+ await sql`
54
+ create index if not exists token_tenant_id_id_type_idx
55
+ on public.token (tenant_id, id, type)
56
+ `.execute(db);
57
+ await sql`
58
+ create index if not exists token_tenant_id_key on public.token (tenant_id)
59
+ `.execute(db);
60
+ }
@@ -0,0 +1,158 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // Every effect, attempt and invalidation write refreshed the action's operation
5
+ // source by aggregating all effects of the action (5,000 to 13,500 rows, 300 ms
6
+ // for the largest Panhandle action), about five times per effect (PRO-19919).
7
+ // While an unapplied effect is still queued or running, the source is only
8
+ // queued or running, so an existence lookup on the partial index decides it.
9
+ // Only the transition into a settled action runs the full aggregation.
10
+ // refresh_audit_action_source (fast path) and recompute_audit_action_source
11
+ // (full) both encode the running and queued conditions: change them together.
12
+ export async function up<Database>(db: Kysely<Database>): Promise<void> {
13
+ // The regional databases got this index concurrently beforehand. Even with
14
+ // `if not exists`, create index takes a share lock on audit.effect first and
15
+ // queues every effect write behind it, so skip the statement when it exists.
16
+ await sql`
17
+ do $$
18
+ begin
19
+ if not exists (
20
+ select 1 from pg_indexes
21
+ where schemaname = 'audit'
22
+ and indexname = 'audit_effect_action_active_idx'
23
+ ) then
24
+ create index audit_effect_action_active_idx
25
+ on audit.effect (action_id)
26
+ where status in ('pending', 'claimed', 'running', 'failed');
27
+ end if;
28
+ end;
29
+ $$
30
+ `.execute(db);
31
+
32
+ await sql`
33
+ alter function core.refresh_audit_action_source(uuid)
34
+ rename to recompute_audit_action_source
35
+ `.execute(db);
36
+
37
+ await sql`
38
+ create function core.refresh_audit_action_source(target_action_id uuid)
39
+ returns void
40
+ language plpgsql
41
+ as $$
42
+ declare
43
+ source_row record;
44
+ next_status core.operation_status;
45
+ begin
46
+ select
47
+ source.operation_id,
48
+ source.started_at,
49
+ operation.type,
50
+ operation.public_id_format
51
+ into source_row
52
+ from core.operation_source as source
53
+ inner join core.operation as operation
54
+ on operation.id = source.operation_id
55
+ where source.source_type = 'audit-action'
56
+ and source.source_id = target_action_id;
57
+
58
+ if found
59
+ and source_row.type = 'reservation-journal-refresh'
60
+ and source_row.started_at is not null then
61
+ select
62
+ case
63
+ when exists (
64
+ select 1
65
+ from audit.effect as effect
66
+ left join accounting.reservation_journal_invalidation as invalidation
67
+ on invalidation.tenant_id = effect.tenant_id
68
+ and invalidation.effect_id = effect.id
69
+ where effect.action_id = target_action_id
70
+ and effect.status in ('claimed', 'running')
71
+ and (invalidation.id is null or invalidation.applied_at is null)
72
+ and (
73
+ source_row.public_id_format = 'legacy'
74
+ or (
75
+ effect.effect_type in (
76
+ 'REFRESH_RESERVATION_JOURNAL',
77
+ 'REFRESH_RECURRING_FEE_RESERVATIONS'
78
+ )
79
+ and effect.entity_type in ('reservation', 'recurringFee')
80
+ )
81
+ )
82
+ ) then 'running'
83
+ when exists (
84
+ select 1
85
+ from audit.effect as effect
86
+ left join accounting.reservation_journal_invalidation as invalidation
87
+ on invalidation.tenant_id = effect.tenant_id
88
+ and invalidation.effect_id = effect.id
89
+ where effect.action_id = target_action_id
90
+ and (
91
+ effect.status = 'pending'
92
+ or (
93
+ effect.status = 'failed'
94
+ and effect.retry_count < effect.max_retries
95
+ )
96
+ )
97
+ and (invalidation.id is null or invalidation.applied_at is null)
98
+ and (
99
+ source_row.public_id_format = 'legacy'
100
+ or (
101
+ effect.effect_type in (
102
+ 'REFRESH_RESERVATION_JOURNAL',
103
+ 'REFRESH_RECURRING_FEE_RESERVATIONS'
104
+ )
105
+ and effect.entity_type in ('reservation', 'recurringFee')
106
+ )
107
+ )
108
+ ) then 'queued'
109
+ end::core.operation_status
110
+ into next_status;
111
+
112
+ if next_status is not null then
113
+ update core.operation_source as source
114
+ set
115
+ status = next_status,
116
+ finished_at = null,
117
+ source_version = source.source_version + 1
118
+ where source.operation_id = source_row.operation_id
119
+ and source.source_type = 'audit-action'
120
+ and source.source_id = target_action_id
121
+ and (
122
+ source.status is distinct from next_status
123
+ or source.finished_at is not null
124
+ );
125
+ perform core.refresh_operation_state(source_row.operation_id);
126
+ return;
127
+ end if;
128
+ end if;
129
+
130
+ perform core.recompute_audit_action_source(target_action_id);
131
+ end;
132
+ $$
133
+ `.execute(db);
134
+
135
+ await sql`
136
+ do $$
137
+ begin
138
+ if exists (select 1 from pg_roles where rolname = 'application') then
139
+ grant execute on function
140
+ core.refresh_audit_action_source(uuid),
141
+ core.recompute_audit_action_source(uuid)
142
+ to application;
143
+ end if;
144
+ end;
145
+ $$
146
+ `.execute(db);
147
+ }
148
+
149
+ export async function down<Database>(db: Kysely<Database>): Promise<void> {
150
+ await sql`drop function core.refresh_audit_action_source(uuid)`.execute(db);
151
+ await sql`
152
+ alter function core.recompute_audit_action_source(uuid)
153
+ rename to refresh_audit_action_source
154
+ `.execute(db);
155
+ await sql`drop index if exists audit.audit_effect_action_active_idx`.execute(
156
+ db
157
+ );
158
+ }
@@ -0,0 +1,44 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // GET /transactions looks up who created each listed transaction in
5
+ // audit.mutation. The general subject index forces a heap read for every
6
+ // mutation of the transaction (updates included) before the INSERT filter, and
7
+ // cold reads took 330-445 ms for 100 rows on the largest teams. This partial index holds only the
8
+ // creation rows and carries the columns the lookup reads. On large databases
9
+ // run scripts/ben-2/pro-19855-create-audit-index.ts first: it builds the index
10
+ // concurrently, and this migration then skips it. The lookup must
11
+ // keep `subject_type` and `op` as constants so a generic plan can use the index.
12
+ export async function up(db: Kysely<unknown>): Promise<void> {
13
+ await sql`set local lock_timeout = '5s'`.execute(db);
14
+ await sql`set local statement_timeout = '30min'`.execute(db);
15
+ const existing = await sql<{ valid: boolean }>`
16
+ select (i.indisvalid and i.indisready) as valid
17
+ from pg_index as i
18
+ inner join pg_class as index_class on index_class.oid = i.indexrelid
19
+ where index_class.relname = 'audit_mutation_transaction_insert_idx'
20
+ `.execute(db);
21
+ // `create index if not exists` locks the table before it finds the index, which
22
+ // times out on a busy database, so skip a valid pre-built index here.
23
+ if (existing.rows[0]?.valid) return;
24
+ // A failed concurrent build leaves an invalid index that `if not exists`
25
+ // would keep, so drop it first.
26
+ if (existing.rows[0]) {
27
+ await sql`
28
+ drop index audit.audit_mutation_transaction_insert_idx
29
+ `.execute(db);
30
+ }
31
+ await sql`
32
+ create index audit_mutation_transaction_insert_idx
33
+ on audit.mutation (tenant_id, subject_id) include (action_id, created_at)
34
+ where subject_type = 'transaction' and op = 'INSERT'
35
+ `.execute(db);
36
+ }
37
+
38
+ export async function down(db: Kysely<unknown>): Promise<void> {
39
+ await sql`set local lock_timeout = '5s'`.execute(db);
40
+ await sql`set local statement_timeout = '60s'`.execute(db);
41
+ await sql`
42
+ drop index if exists audit.audit_mutation_transaction_insert_idx
43
+ `.execute(db);
44
+ }
@@ -0,0 +1,24 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // GRO-1875: tell owner and friends & family stays apart from guest bookings. The
5
+ // constant default makes the column a catalog-only change, and older writers
6
+ // that omit it keep inserting guest stays.
7
+ export async function up(db: Kysely<unknown>): Promise<void> {
8
+ await sql`set local lock_timeout = '5s'`.execute(db);
9
+
10
+ await sql`
11
+ create type public.reservation_stay_type as enum ('guest', 'owner', 'ownerGuest')
12
+ `.execute(db);
13
+ await sql`
14
+ alter table public.reservation
15
+ add column stay_type public.reservation_stay_type not null default 'guest'
16
+ `.execute(db);
17
+ }
18
+
19
+ export async function down(db: Kysely<unknown>): Promise<void> {
20
+ await sql`
21
+ alter table public.reservation drop column if exists stay_type
22
+ `.execute(db);
23
+ await sql`drop type if exists public.reservation_stay_type`.execute(db);
24
+ }
@@ -0,0 +1,21 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19960: Long-term Liabilities shared index 32 with Other Current
5
+ // Liabilities, so the name tiebreak listed it first. Current comes before
6
+ // long-term, as on a balance sheet.
7
+ export async function up(db: Kysely<unknown>): Promise<void> {
8
+ await sql`
9
+ update accounting.account_category
10
+ set "index" = 33
11
+ where id = '3022ebdd-3673-448c-a15d-eaa16a5a4a43'::uuid
12
+ `.execute(db);
13
+ }
14
+
15
+ export async function down(db: Kysely<unknown>): Promise<void> {
16
+ await sql`
17
+ update accounting.account_category
18
+ set "index" = 32
19
+ where id = '3022ebdd-3673-448c-a15d-eaa16a5a4a43'::uuid
20
+ `.execute(db);
21
+ }
@@ -0,0 +1,13 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ // Expand storage only. The code must be writable on every channel before
6
+ // API producers mark it dirty in shared regional databases.
7
+ await sql`alter type health.tenant_issue_code add value if not exists 'pmsSyncFailures'`.execute(
8
+ db
9
+ );
10
+ }
11
+
12
+ // PostgreSQL enum additions are retained so historical issues remain readable.
13
+ export async function down(_db: Kysely<unknown>): Promise<void> {}
@@ -0,0 +1,21 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19939: taxability is stored once per line type on the base mapping row.
5
+ // The constant default makes the column a catalog-only change, and older
6
+ // writers that omit it keep inserting untaxed line types.
7
+ export async function up(db: Kysely<unknown>): Promise<void> {
8
+ await sql`set local lock_timeout = '5s'`.execute(db);
9
+
10
+ await sql`
11
+ alter table accounting.account_reservation_line_type
12
+ add column taxable boolean not null default false
13
+ `.execute(db);
14
+ }
15
+
16
+ export async function down(db: Kysely<unknown>): Promise<void> {
17
+ await sql`
18
+ alter table accounting.account_reservation_line_type
19
+ drop column if exists taxable
20
+ `.execute(db);
21
+ }
@@ -0,0 +1,20 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19939: a VRPilot suggestion may carry no taxable opinion, which the
5
+ // not null `taxable` column cannot store. Only suggestion rows use this column.
6
+ export async function up(db: Kysely<unknown>): Promise<void> {
7
+ await sql`set local lock_timeout = '5s'`.execute(db);
8
+
9
+ await sql`
10
+ alter table accounting.account_reservation_line_type
11
+ add column suggestion_taxable boolean
12
+ `.execute(db);
13
+ }
14
+
15
+ export async function down(db: Kysely<unknown>): Promise<void> {
16
+ await sql`
17
+ alter table accounting.account_reservation_line_type
18
+ drop column if exists suggestion_taxable
19
+ `.execute(db);
20
+ }
@@ -0,0 +1,44 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // PRO-19798: every contact starts on "outside" and a default never points at
5
+ // a method whose details are missing. ACH via Ramp needs bank details in VRT
6
+ // or at Ramp, ACH via Nacha needs bank details in VRT, check needs an address.
7
+ // Deployed writers may still store null, so NOT NULL waits for a later migration.
8
+ export async function up(db: Kysely<unknown>): Promise<void> {
9
+ await sql`set local lock_timeout = '5s'`.execute(db);
10
+ await sql`set local statement_timeout = '60s'`.execute(db);
11
+
12
+ await sql`
13
+ alter table accounting.contact
14
+ alter column default_payment_method set default 'outside'
15
+ `.execute(db);
16
+ // The backfill is not an edit: keep updated_at and skip audit triggers.
17
+ await sql`alter table accounting.contact disable trigger user`.execute(db);
18
+ await sql`
19
+ update accounting.contact contact
20
+ set default_payment_method = 'outside'
21
+ where default_payment_method is null
22
+ or (
23
+ default_payment_method = 'check'
24
+ and coalesce(trim(address_data->>'line1'), '') = ''
25
+ )
26
+ or (
27
+ default_payment_method in ('rampAch', 'nachaAch')
28
+ and not exists (
29
+ select 1 from accounting.contact_bank_account bank
30
+ where bank.contact_id = contact.id
31
+ )
32
+ and (default_payment_method = 'nachaAch' or ramp_last4_digits is null)
33
+ )
34
+ `.execute(db);
35
+ await sql`alter table accounting.contact enable trigger user`.execute(db);
36
+ }
37
+
38
+ // Backfilled and chosen "outside" values are indistinguishable, so they stay.
39
+ export async function down(db: Kysely<unknown>): Promise<void> {
40
+ await sql`
41
+ alter table accounting.contact
42
+ alter column default_payment_method drop default
43
+ `.execute(db);
44
+ }