@vrplatform/kysely 1.3.45-stage.4368 → 1.3.45-stage.43703848639
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.
- package/build/.data.tar +2 -2
- package/build/main/camel-case/index.d.ts +4 -4
- package/build/main/camel-case/index.js +3 -2
- package/build/main/camel-case/index.js.map +1 -1
- package/build/main/connect-handoff.d.ts +12 -0
- package/build/main/connect-handoff.js +73 -0
- package/build/main/connect-handoff.js.map +1 -0
- package/build/main/control-plane/index.d.ts +413 -14
- package/build/main/control-plane/index.js +71 -0
- package/build/main/control-plane/index.js.map +1 -1
- package/build/main/domain.d.ts +4 -0
- package/build/main/domain.js +3 -0
- package/build/main/domain.js.map +1 -0
- package/build/main/error.d.ts +2 -1
- package/build/main/error.js +2 -1
- package/build/main/error.js.map +1 -1
- package/build/main/index.d.ts +57 -15
- package/build/main/index.js +498 -66
- package/build/main/index.js.map +1 -1
- package/build/main/isomorphic.d.ts +6 -6
- package/build/main/isomorphic.js +4 -8
- package/build/main/isomorphic.js.map +1 -1
- package/build/main/local/digest.d.ts +3 -3
- package/build/main/local/digest.js.map +1 -1
- package/build/main/local/generate.js +15 -13
- package/build/main/local/generate.js.map +1 -1
- package/build/main/local/index.d.ts +5 -1
- package/build/main/local/index.js +346 -12
- package/build/main/local/index.js.map +1 -1
- package/build/main/local/prune-pulled-schema.js +4 -1
- package/build/main/local/prune-pulled-schema.js.map +1 -1
- package/build/main/migration-source.d.ts +4 -0
- package/build/main/migration-source.js +45 -0
- package/build/main/migration-source.js.map +1 -0
- package/build/main/migration.d.ts +7 -0
- package/build/main/migration.js +11 -0
- package/build/main/migration.js.map +1 -0
- package/build/main/pganalyze-comment-plugin/comment-transformer.js +3 -1
- package/build/main/pganalyze-comment-plugin/comment-transformer.js.map +1 -1
- package/build/main/pganalyze-comment-plugin/index.js.map +1 -1
- package/build/main/plugins.d.ts +2 -2
- package/build/main/plugins.js.map +1 -1
- package/build/main/postgres-error.d.ts +9 -0
- package/build/main/postgres-error.js +28 -0
- package/build/main/postgres-error.js.map +1 -0
- package/build/main/query/index.d.ts +1 -0
- package/build/main/query/index.js +1 -0
- package/build/main/query/index.js.map +1 -1
- package/build/main/query/listing/status.d.ts +2 -12
- package/build/main/query/listing/status.js +35 -20
- package/build/main/query/listing/status.js.map +1 -1
- package/build/main/query/tenant/billing-partner.d.ts +4 -0
- package/build/main/query/tenant/billing-partner.js +8 -0
- package/build/main/query/tenant/billing-partner.js.map +1 -0
- package/build/main/query/tenant/feature-enabled.d.ts +6 -0
- package/build/main/query/tenant/feature-enabled.js +30 -0
- package/build/main/query/tenant/feature-enabled.js.map +1 -0
- package/build/main/query/tenant/index.d.ts +4 -0
- package/build/main/query/tenant/index.js +21 -0
- package/build/main/query/tenant/index.js.map +1 -0
- package/build/main/query/tenant/status.d.ts +9 -0
- package/build/main/query/tenant/status.js +32 -0
- package/build/main/query/tenant/status.js.map +1 -0
- package/build/main/query/tenant/where-uuid-in.d.ts +2 -0
- package/build/main/query/tenant/where-uuid-in.js +14 -0
- package/build/main/query/tenant/where-uuid-in.js.map +1 -0
- package/build/main/regional.d.ts +31 -4
- package/build/main/regional.js +69 -8
- package/build/main/regional.js.map +1 -1
- package/build/main/test/index.d.ts +21 -11
- package/build/main/test/index.js +31 -26
- package/build/main/test/index.js.map +1 -1
- package/build/main/transaction.d.ts +3 -3
- package/build/main/transaction.js.map +1 -1
- package/build/main/v1.generated.d.ts +1333 -90
- package/build/main/v1.generated.js.map +1 -1
- package/build/migrations-v2/0000000000000-baseline.ts +5 -0
- package/build/migrations-v2/0000000000001-public-audit-events-v2.ts +137 -0
- package/build/migrations-v2/0000000000002-audit-recovery-watermarks.ts +30 -0
- package/build/migrations-v2/0000000000003-audit-effect-recovery-watermark.ts +13 -0
- package/build/migrations-v2/0000000000004-audit-event-projected-at.ts +15 -0
- package/build/migrations-v2/0000000000005-audit-recovery-indexes.ts +63 -0
- package/build/migrations-v2/0000000000006-audit-action-public-event-projected-at.ts +22 -0
- package/build/migrations-v2/0000000000007-audit-action-public-event-projected-at-backfill.ts +35 -0
- package/build/migrations-v2/0000000000008-global-user-attribution.ts +33 -0
- package/build/migrations-v2/0000000000008-team-issue-rule-state.ts +52 -0
- package/build/migrations-v2/0000000000009-reservation-issue-projections.ts +45 -0
- package/build/migrations-v2/0000000000010-bank-rule-application-bank-record-delete-cascade.ts +26 -0
- package/build/migrations-v2/0000000000011-guest-balance-journal-entry-lookup-index.ts +25 -0
- package/build/migrations-v2/0000000000012-trial-free-analytics-billing-status.ts +72 -0
- package/build/migrations-v2/0000000000013-ui-permission-bundles.ts +45 -0
- package/build/migrations-v2/0000000000014-ui-permission-bundle-top-up.ts +32 -0
- package/build/migrations-v2/0000000000015-durable-flow-events.ts +163 -0
- package/build/migrations-v2/0000000000016-billing-listing-facts.ts +539 -0
- package/build/migrations-v2/0000000000016-managed-team-access.ts +34 -0
- package/build/migrations-v2/0000000000017-drop-trial-until.ts +42 -0
- package/build/migrations-v2/0000000000017-webhook-secret-reencryption-failures.ts +18 -0
- package/build/migrations-v2/0000000000018-accounting-integrity-monitoring.ts +276 -0
- package/build/migrations-v2/0000000000018-durable-flow-event-sensitive-input.ts +28 -0
- package/build/migrations-v2/0000000000019-accounting-integrity-run-shards.ts +26 -0
- package/build/migrations-v2/0000000000019-asynchronous-operations.ts +736 -0
- package/build/migrations-v2/0000000000020-accounting-integrity-case-classification.ts +52 -0
- package/build/migrations-v2/0000000000021-payment-line-classification-monitor-indexes.ts +31 -0
- package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
- package/build/migrations-v2/0000000000023-line-classification-usage.ts +325 -0
- package/build/migrations-v2/0000000000024-tenant-region-migration.ts +108 -0
- package/build/migrations-v2/0000000000025-partner-ach-denial-default.ts +30 -0
- package/build/migrations-v2/0000000000026-line-classification-usage-capture.ts +399 -0
- package/build/migrations-v2/0000000000027-payout-replacement-chain.ts +27 -0
- package/build/migrations-v2/0000000000028-accounting-integrity-operator-workflow.ts +108 -0
- package/build/migrations-v2/0000000000029-accounting-integrity-definition-artifacts.ts +40 -0
- package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts +49 -0
- package/build/migrations-v2/0000000000031-ui-permission-role-simplification.ts +70 -0
- package/build/migrations-v2/0000000000032-tenant-delete-ownership-cascades.ts +44 -0
- package/build/migrations-v2/0000000000033-plaid-connect-session-telemetry.ts +31 -0
- package/build/migrations-v2/0000000000033-reservation-issue-seed-bucket-index.ts +19 -0
- package/build/migrations-v2/0000000000034-retire-recent-classification-indexes.ts +29 -0
- package/build/migrations-v2/0000000000035-core-change-autovacuum.ts +24 -0
- package/build/migrations-v2/0000000000036-journal-entry-inactive-reason-constraint.ts +33 -0
- package/build/migrations-v2/0000000000037-journal-entry-inactive-reasons.ts +19 -0
- package/build/{migrations/0000000000023-journal-entry-currency-mismatch-reason.ts → migrations-v2/0000000000038-journal-entry-group-inactive-reason.ts} +4 -4
- package/build/migrations-v2/0000000000039-reservation-guest-breakdown.ts +19 -0
- package/build/migrations-v2/0000000000040-csv-import-source-identity-index.ts +23 -0
- package/build/migrations-v2/0000000000041-payment-returns.ts +38 -0
- package/build/migrations-v2/0000000000042-operation-resource-types.ts +609 -0
- package/build/migrations-v2/0000000000043-reservation-journal-freshness.ts +149 -0
- package/build/migrations-v2/0000000000044-reservation-journal-freshness-backfill.ts +254 -0
- package/build/migrations-v2/0000000000045-reservation-journal-freshness-revision-repair.ts +83 -0
- package/build/migrations-v2/0000000000046-materialized-reservation-journal-operations.ts +709 -0
- package/build/migrations-v2/0000000000047-public-audit-completion.ts +77 -0
- package/build/migrations-v2/0000000000048-reservation-journal-full-refresh-repair.ts +136 -0
- package/build/migrations-v2/0000000000049-queued-journal-operation-failures.ts +60 -0
- package/build/migrations-v2/0000000000050-connection-oauth-state.ts +43 -0
- package/build/migrations-v2/0000000000051-owner-statement-email-delivery.ts +134 -0
- package/build/migrations-v2/0000000000052-fee-journal-lock-skip-operations.ts +59 -0
- package/build/migrations-v2/0000000000053-fee-journal-lock-skip-null-attempt.ts +44 -0
- package/build/migrations-v2/0000000000054-journal-refresh-issue-codes.ts +16 -0
- package/build/migrations-v2/0000000000055-tenant-billing-subscription.ts +8 -0
- package/build/migrations-v2/0000000000056-journal-operation-failure-precedence.ts +306 -0
- package/build/migrations-v2/0000000000057-journal-invalidation-failure-code.ts +28 -0
- package/build/migrations-v2/0000000000058-journal-invalidation-locked-failure.ts +16 -0
- package/build/migrations-v2/0000000000059-billing-active-listing-cross-region-partner.ts +135 -0
- package/build/migrations-v2/0000000000060-accounting-integrity-change-driven.ts +99 -0
- package/build/migrations-v2/0000000000061-tenant-pending-onboarding-status.ts +37 -0
- package/build/migrations-v2/0000000000062-statement-payout-operations.ts +16 -0
- package/build/migrations-v2/0000000000063-missing-account-assignments-issue-code.ts +13 -0
- package/build/migrations-v2/0000000000064-journal-invalidation-source-lookup-index.ts +26 -0
- package/build/migrations-v2/0000000000065-hasura-connection-event-credentials.ts +42 -0
- package/build/migrations-v2/0000000000066-recurring-fee-listing-subscription-match-by.ts +51 -0
- package/build/migrations-v2/0000000000067-connection-credential-metadata.ts +60 -0
- package/build/migrations-v2/0000000000068-connection-credential-version.ts +34 -0
- package/build/migrations-v2/0000000000069-owner-statement-contact-email-delivery.ts +84 -0
- package/build/migrations-v2/0000000000070-payment-writer-compatibility.ts +69 -0
- package/build/migrations-v2/0000000000071-payments.ts +532 -0
- package/build/migrations-v2/0000000000072-journal-entry-payment-index.ts +21 -0
- package/build/migrations-v2/0000000000073-batch-invalidation-operation-registration.ts +74 -0
- package/build/migrations-v2/0000000000074-owner-statement-email-history.ts +34 -0
- package/build/migrations-v2/0000000000075-tenant-deletion-lookup-indexes.ts +46 -0
- package/build/migrations-v2/0000000000076-tenant-onboarding-not-null.ts +23 -0
- package/build/migrations-v2/0000000000077-payment-writer-statement-attachment.ts +92 -0
- package/build/migrations-v2/0000000000078-trigger-timeout-indexes.ts +44 -0
- package/build/migrations-v2/0000000000079-core-change-tenant-statistics.ts +26 -0
- package/build/migrations-v2/0000000000080-drop-legacy-tracking-event.ts +60 -0
- package/build/migrations-v2/0000000000081-recurring-fee-planner-operation-status.ts +35 -0
- package/build/migrations-v2/0000000000082-reservation-search-trigram-indexes.ts +54 -0
- package/build/migrations-v2/0000000000083-journal-entry-deposit-lookup-index.ts +31 -0
- package/build/migrations-v2/0000000000084-journal-entry-reservation-revenue-indexes.ts +57 -0
- package/build/migrations-v2/0000000000085-owner-statement-link-email-template.ts +23 -0
- package/build/migrations-v2/0000000000086-contact-payment-setup.ts +72 -0
- package/build/migrations-v2/0000000000087-address-delete-fk-indexes.ts +30 -0
- package/build/migrations-v2/0000000000088-owner-statement-email-switch.ts +76 -0
- package/build/migrations-v2/0000000000089-contact-bank-details-requested-at.ts +21 -0
- package/build/migrations-v2/0000000000090-contact-bank-account-api-key.ts +22 -0
- package/build/migrations-v2/0000000000091-contact-bank-details-request.ts +78 -0
- package/build/migrations-v2/0000000000092-payment-provider-reference.ts +22 -0
- package/build/migrations-v2/0000000000093-payment-reversal-offline-undo.ts +18 -0
- package/build/migrations-v2/0000000000094-reservation-status-checkout-index.ts +37 -0
- package/build/migrations-v2/0000000000095-payment-batches.ts +196 -0
- package/build/migrations-v2/0000000000096-guide-ongoing-tasks-issue-codes.ts +26 -0
- package/build/migrations-v2/0000000000097-reservation-line-mapping-suggestions.ts +53 -0
- package/build/migrations-v2/0000000000098-cancelled-reservation-balances-issue-code.ts +13 -0
- package/build/migrations-v2/0000000000099-contact-bank-account-request-source.ts +28 -0
- package/build/migrations-v2/0000000000100-drop-regional-feature-flags.ts +105 -0
- package/build/migrations-v2/0000000000101-bank-record-match-source.ts +45 -0
- package/build/migrations-v2/0000000000102-owner-statement-email-one-template.ts +63 -0
- package/build/migrations-v2/0000000000103-reservation-line-mapping-update-operation.ts +10 -0
- package/build/migrations-v2/0000000000104-export-job-payment-batch-pdf.ts +12 -0
- package/build/migrations-v2/0000000000105-drop-regional-token.ts +60 -0
- package/build/migrations-v2/0000000000106-incremental-audit-action-source.ts +158 -0
- package/build/migrations-v2/0000000000107-audit-mutation-transaction-insert-index.ts +44 -0
- package/build/migrations-v2/0000000000108-reservation-stay-type.ts +24 -0
- package/build/migrations-v2/0000000000109-long-term-liabilities-category-order.ts +21 -0
- package/build/migrations-v2/0000000000110-pms-sync-failures-issue-code.ts +13 -0
- package/build/migrations-v2/0000000000110-reservation-line-type-taxable.ts +21 -0
- package/build/migrations-v2/0000000000111-reservation-line-type-suggestion-taxable.ts +20 -0
- package/build/migrations-v2/0000000000112-contact-payment-method-outside-default.ts +44 -0
- package/build/migrations-v2/0000000000113-merchant-fee-reference-assignment.ts +25 -0
- package/build/migrations-v2/0000000000114-recurring-fee-nights-filter.ts +32 -0
- package/build/migrations-v2/0000000000115-bank-records-with-suggested-rule-issue-code.ts +13 -0
- package/build/migrations-v2/0000000000116-guest-review.ts +45 -0
- package/build/migrations-v2/0000000000117-ramp-external-funding-accounts.ts +91 -0
- package/build/migrations-v2/0000000000118-pm-payout-assignment.ts +25 -0
- package/build/migrations-v2/0000000000119-chart-of-accounts-classifications.ts +46 -0
- package/build/migrations-v2/0000000000120-feedback.ts +41 -0
- package/build/migrations-v2/0000000000121-source-owner-block-calendar-index.ts +43 -0
- package/build/migrations-v2/0000000000122-recurring-fee-stay-types-filter.ts +20 -0
- package/build/migrations-v2/0000000000123-reservation-owner-stay-type-index.ts +40 -0
- package/build/migrations-v2/0000000000124-remove-tenant-test-and-billable-columns.ts +63 -0
- package/build/migrations-v2/0000000000125-ramp-application.ts +56 -0
- package/build/migrations-v2/0000000000126-advanced-deposits-update-operation.ts +10 -0
- package/build/migrations-v2/0000000000127-contact-1099-tax-details.ts +46 -0
- package/build/migrations-v2/0000000000128-tax-1099-email-templates.ts +36 -0
- package/build/migrations-v2/0000000000129-tenant-locked-at.ts +18 -0
- package/build/migrations-v2/0000000000130-second-factor-reset.ts +65 -0
- package/build/migrations-v2/0000000000131-payout-hold.ts +49 -0
- package/build/migrations-v2/0000000000132-member-invite-approval.ts +62 -0
- package/build/migrations-v2/0000000000133-audit-action-client-ip.ts +38 -0
- package/build/migrations-v2/0000000000134-drop-orphaned-hasura-triggers.ts +39 -0
- package/build/migrations-v2/0000000000135-drop-orphaned-hasura-triggers-literal.ts +42 -0
- package/build/migrations-v2/0000000000136-drop-all-hasura-triggers.ts +43 -0
- package/build/migrations-v2/0000000000137-webhook-event.ts +57 -0
- package/build/module/camel-case/index.d.ts +4 -4
- package/build/module/camel-case/index.js +4 -3
- package/build/module/camel-case/index.js.map +1 -1
- package/build/module/connect-handoff.d.ts +12 -0
- package/build/module/connect-handoff.js +70 -0
- package/build/module/connect-handoff.js.map +1 -0
- package/build/module/control-plane/index.d.ts +413 -14
- package/build/module/control-plane/index.js +58 -1
- package/build/module/control-plane/index.js.map +1 -1
- package/build/module/domain.d.ts +4 -0
- package/build/module/domain.js +2 -0
- package/build/module/domain.js.map +1 -0
- package/build/module/error.d.ts +2 -1
- package/build/module/error.js +3 -1
- package/build/module/error.js.map +1 -1
- package/build/module/index.d.ts +57 -15
- package/build/module/index.js +496 -64
- package/build/module/index.js.map +1 -1
- package/build/module/isomorphic.d.ts +6 -6
- package/build/module/isomorphic.js +2 -7
- package/build/module/isomorphic.js.map +1 -1
- package/build/module/local/digest.d.ts +3 -3
- package/build/module/local/digest.js.map +1 -1
- package/build/module/local/generate.js +15 -13
- package/build/module/local/generate.js.map +1 -1
- package/build/module/local/index.d.ts +5 -1
- package/build/module/local/index.js +347 -13
- package/build/module/local/index.js.map +1 -1
- package/build/module/local/prune-pulled-schema.js +4 -1
- package/build/module/local/prune-pulled-schema.js.map +1 -1
- package/build/module/migration-source.d.ts +4 -0
- package/build/module/migration-source.js +42 -0
- package/build/module/migration-source.js.map +1 -0
- package/build/module/migration.d.ts +7 -0
- package/build/module/migration.js +8 -0
- package/build/module/migration.js.map +1 -0
- package/build/module/pganalyze-comment-plugin/comment-transformer.js +3 -1
- package/build/module/pganalyze-comment-plugin/comment-transformer.js.map +1 -1
- package/build/module/plugins.d.ts +2 -2
- package/build/module/plugins.js.map +1 -1
- package/build/module/postgres-error.d.ts +9 -0
- package/build/module/postgres-error.js +24 -0
- package/build/module/postgres-error.js.map +1 -0
- package/build/module/query/index.d.ts +1 -0
- package/build/module/query/index.js +1 -0
- package/build/module/query/index.js.map +1 -1
- package/build/module/query/listing/status.d.ts +2 -12
- package/build/module/query/listing/status.js +35 -18
- package/build/module/query/listing/status.js.map +1 -1
- package/build/module/query/tenant/billing-partner.d.ts +4 -0
- package/build/module/query/tenant/billing-partner.js +5 -0
- package/build/module/query/tenant/billing-partner.js.map +1 -0
- package/build/module/query/tenant/feature-enabled.d.ts +6 -0
- package/build/module/query/tenant/feature-enabled.js +27 -0
- package/build/module/query/tenant/feature-enabled.js.map +1 -0
- package/build/module/query/tenant/index.d.ts +4 -0
- package/build/module/query/tenant/index.js +5 -0
- package/build/module/query/tenant/index.js.map +1 -0
- package/build/module/query/tenant/status.d.ts +9 -0
- package/build/module/query/tenant/status.js +28 -0
- package/build/module/query/tenant/status.js.map +1 -0
- package/build/module/query/tenant/where-uuid-in.d.ts +2 -0
- package/build/module/query/tenant/where-uuid-in.js +11 -0
- package/build/module/query/tenant/where-uuid-in.js.map +1 -0
- package/build/module/regional.d.ts +31 -4
- package/build/module/regional.js +68 -8
- package/build/module/regional.js.map +1 -1
- package/build/module/test/index.d.ts +21 -11
- package/build/module/test/index.js +31 -26
- package/build/module/test/index.js.map +1 -1
- package/build/module/transaction.d.ts +3 -3
- package/build/module/transaction.js.map +1 -1
- package/build/module/v1.generated.d.ts +1333 -90
- package/build/module/v1.generated.js.map +1 -1
- package/package.json +19 -16
- package/build/migrations/0000000000001-init.ts +0 -5
- package/build/migrations/0000000000009-drop-store-schema.ts +0 -14
- package/build/migrations/0000000000010-bank-rules.ts +0 -190
- package/build/migrations/0000000000011-bank-rule-line-adjustments.ts +0 -65
- package/build/migrations/0000000000012-bank-rule-conditions.ts +0 -45
- package/build/migrations/0000000000013-bank-rule-name-unique.ts +0 -15
- package/build/migrations/0000000000014-bank-rule-drop-legacy-conditions.ts +0 -41
- package/build/migrations/0000000000015-booking-channel-logo-dev-provider.ts +0 -70
- package/build/migrations/0000000000016-owner-statement-draft-status.ts +0 -22
- package/build/migrations/0000000000017-tenant-migration-markers.ts +0 -18
- package/build/migrations/0000000000018-security-deposits-payable-category.ts +0 -63
- package/build/migrations/0000000000019-tenant-app-settings.ts +0 -76
- package/build/migrations/0000000000020-operating-opening-trial-balance.ts +0 -36
- package/build/migrations/0000000000021-audit-foreign-key-indexes.ts +0 -77
- package/build/migrations/0000000000022-opening-trial-balance-combined-columns.ts +0 -30
- package/build/migrations/0000000000024-listing-parent.ts +0 -37
- package/build/migrations/0000000000025-journal-entry-parent-listing.ts +0 -26
- package/build/migrations/0000000000026-booking-channel-logo-slots.ts +0 -89
- package/build/migrations/0000000000027-list-browse-performance-indexes.ts +0 -52
- package/build/migrations/0000000000028-flow-setting-status-jsonb.ts +0 -20
- package/build/migrations/0000000000029-tenant-slug.ts +0 -328
- package/build/migrations/0000000000030-pms-accounting-windows.ts +0 -50
- package/build/migrations/0000000000031-owner-statement-projection-listing-revision.ts +0 -20
- package/build/migrations/0000000000032-flow-event-listening.ts +0 -28
- package/build/migrations/0000000000033-opening-trial-balance-transaction.ts +0 -272
- package/build/migrations/0000000000034-historic-general-ledger.ts +0 -24
- package/build/migrations/0000000000035-tenant-regional-placement.ts +0 -37
- package/build/migrations/0000000000036-control-plane-projection-events.ts +0 -43
- package/build/migrations/0000000000037-tenant-guide-onboarding.ts +0 -21
- package/build/migrations/0000000000038-tracking-event-analytics-sink.ts +0 -31
- package/build/migrations/0000000000039-crunchy-region.ts +0 -86
- package/build/migrations/0000000000040-hostaway-region.ts +0 -72
- package/build/migrations/0000000000041-audit-tenant-fk.ts +0 -66
- package/build/migrations/0000000000042-ramp-staging-connect-params.ts +0 -35
- package/build/migrations/0000000000043-gl-pms-accounting-window-guard.ts +0 -125
- package/build/migrations/0000000000044-tenant-cross-region-fks.ts +0 -45
- package/build/migrations/0000000000045-cloudflare-region-env.ts +0 -100
- package/build/migrations/0000000000046-control-plane-outbox-alias.ts +0 -46
- package/build/migrations/0000000000047-ramp-contact-last-4-digits.ts +0 -16
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// VRT-766: every team emails owner statements to owner contact addresses.
|
|
5
|
+
// - statement_email_enabled is the team's switch per owner. Null follows the
|
|
6
|
+
// default: on while the owner has an active portal login, off otherwise.
|
|
7
|
+
// - Owners whose portal logins all turned statement emails off stay opted
|
|
8
|
+
// out once the portal user email no longer reaches them.
|
|
9
|
+
// - Teams keep their saved statement email text in the link email. The
|
|
10
|
+
// preview line told owners to log in, so it takes the no-login default.
|
|
11
|
+
// Code that predates the switch ignores the column, and only teams with the
|
|
12
|
+
// email links flag read the opt-outs and link templates.
|
|
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
|
+
alter table accounting.contact
|
|
19
|
+
add column if not exists statement_email_enabled boolean
|
|
20
|
+
`.execute(db);
|
|
21
|
+
|
|
22
|
+
await sql`
|
|
23
|
+
update accounting.contact contact
|
|
24
|
+
set statement_email_unsubscribed_at = now()
|
|
25
|
+
where contact.type = 'owner'
|
|
26
|
+
and contact.statement_email_unsubscribed_at is null
|
|
27
|
+
and exists (
|
|
28
|
+
select 1
|
|
29
|
+
from public.owner_user_access access
|
|
30
|
+
join public.tenant_user tenant_user
|
|
31
|
+
on tenant_user.user_id = access.user_id
|
|
32
|
+
and tenant_user.tenant_id = contact.tenant_id
|
|
33
|
+
and tenant_user.role = 'owner'
|
|
34
|
+
and tenant_user.status = 'active'
|
|
35
|
+
where access.contact_id = contact.id
|
|
36
|
+
and access.role = 'admin'
|
|
37
|
+
)
|
|
38
|
+
and not exists (
|
|
39
|
+
select 1
|
|
40
|
+
from public.owner_user_access access
|
|
41
|
+
join public.tenant_user tenant_user
|
|
42
|
+
on tenant_user.user_id = access.user_id
|
|
43
|
+
and tenant_user.tenant_id = contact.tenant_id
|
|
44
|
+
and tenant_user.role = 'owner'
|
|
45
|
+
and tenant_user.status = 'active'
|
|
46
|
+
where access.contact_id = contact.id
|
|
47
|
+
and access.role = 'admin'
|
|
48
|
+
and not coalesce(tenant_user.notification_preferences, '[]'::jsonb)
|
|
49
|
+
? 'owner-statements.published.disabled'
|
|
50
|
+
)
|
|
51
|
+
`.execute(db);
|
|
52
|
+
|
|
53
|
+
await sql`
|
|
54
|
+
insert into public.email_template (tenant_id, type, data_json)
|
|
55
|
+
select
|
|
56
|
+
template.tenant_id,
|
|
57
|
+
'ownerStatementLink_owner',
|
|
58
|
+
template.data_json || jsonb_build_object(
|
|
59
|
+
'shortDescription',
|
|
60
|
+
'Your owner statement is ready. Open it with one click, no login needed.'
|
|
61
|
+
)
|
|
62
|
+
from public.email_template template
|
|
63
|
+
join public.tenant tenant on tenant.id = template.tenant_id
|
|
64
|
+
where template.type = 'ownerStatement_owner'
|
|
65
|
+
and tenant.storage_realm = 'vrtrust'
|
|
66
|
+
on conflict (tenant_id, type) do nothing
|
|
67
|
+
`.execute(db);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Opt-outs and copied templates are owner and team data by now, so they stay.
|
|
71
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
72
|
+
await sql`
|
|
73
|
+
alter table accounting.contact
|
|
74
|
+
drop column if exists statement_email_enabled
|
|
75
|
+
`.execute(db);
|
|
76
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19485/PRO-19486: when the team last emailed an owner or vendor a
|
|
5
|
+
// request for bank details. Expand only; code that predates it ignores it.
|
|
6
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
7
|
+
await sql`set local lock_timeout = '5s'`.execute(db);
|
|
8
|
+
await sql`set local statement_timeout = '60s'`.execute(db);
|
|
9
|
+
|
|
10
|
+
await sql`
|
|
11
|
+
alter table accounting.contact
|
|
12
|
+
add column if not exists bank_details_requested_at timestamptz
|
|
13
|
+
`.execute(db);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
17
|
+
await sql`
|
|
18
|
+
alter table accounting.contact
|
|
19
|
+
drop column if exists bank_details_requested_at
|
|
20
|
+
`.execute(db);
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19531: the API key that last changed a bank account when no user did.
|
|
5
|
+
// API keys live in the control plane, so there is no foreign key. Expand
|
|
6
|
+
// only; code that predates it ignores the column.
|
|
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`
|
|
12
|
+
alter table accounting.contact_bank_account
|
|
13
|
+
add column if not exists updated_by_api_token_id uuid
|
|
14
|
+
`.execute(db);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
18
|
+
await sql`
|
|
19
|
+
alter table accounting.contact_bank_account
|
|
20
|
+
drop column if exists updated_by_api_token_id
|
|
21
|
+
`.execute(db);
|
|
22
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19485/PRO-19486: one row per bank details request email, so the team
|
|
5
|
+
// sees whether it went out, when its link expires, and when a vendor opened
|
|
6
|
+
// it. accounting.contact.bank_details_requested_at stays the time of the
|
|
7
|
+
// latest request. Expand only; code that predates it ignores the table.
|
|
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_details_request_delivery as enum (
|
|
14
|
+
'queued', 'sent', 'failed', 'skipped'
|
|
15
|
+
)
|
|
16
|
+
`.execute(db);
|
|
17
|
+
await sql`
|
|
18
|
+
create table accounting.contact_bank_details_request (
|
|
19
|
+
id uuid primary key default gen_random_uuid(),
|
|
20
|
+
tenant_id uuid not null references public.tenant (id) on delete restrict,
|
|
21
|
+
contact_id uuid not null references accounting.contact (id) on delete cascade,
|
|
22
|
+
requested_at timestamptz not null,
|
|
23
|
+
requested_by_user_id uuid null references public.user (id) on delete set null,
|
|
24
|
+
delivery accounting.bank_details_request_delivery not null default 'queued',
|
|
25
|
+
recipient_email text null,
|
|
26
|
+
sent_at timestamptz null,
|
|
27
|
+
link_expires_at timestamptz null,
|
|
28
|
+
opened_at timestamptz null,
|
|
29
|
+
created_at timestamptz not null default now(),
|
|
30
|
+
updated_at timestamptz not null default now()
|
|
31
|
+
)
|
|
32
|
+
`.execute(db);
|
|
33
|
+
await sql`
|
|
34
|
+
create index contact_bank_details_request_contact_idx
|
|
35
|
+
on accounting.contact_bank_details_request (contact_id, requested_at desc)
|
|
36
|
+
`.execute(db);
|
|
37
|
+
await sql`
|
|
38
|
+
create index contact_bank_details_request_tenant_id_idx
|
|
39
|
+
on accounting.contact_bank_details_request (tenant_id)
|
|
40
|
+
`.execute(db);
|
|
41
|
+
// Requests sent before this table existed: vendor links lasted 14 days;
|
|
42
|
+
// owner links are treated as not expiring.
|
|
43
|
+
await sql`
|
|
44
|
+
insert into accounting.contact_bank_details_request
|
|
45
|
+
(tenant_id, contact_id, requested_at, delivery, sent_at, link_expires_at)
|
|
46
|
+
select
|
|
47
|
+
contact.tenant_id,
|
|
48
|
+
contact.id,
|
|
49
|
+
contact.bank_details_requested_at,
|
|
50
|
+
'sent',
|
|
51
|
+
contact.bank_details_requested_at,
|
|
52
|
+
case
|
|
53
|
+
when contact.type = 'vendor'
|
|
54
|
+
then contact.bank_details_requested_at + interval '14 days'
|
|
55
|
+
end
|
|
56
|
+
from accounting.contact contact
|
|
57
|
+
where contact.bank_details_requested_at is not null
|
|
58
|
+
`.execute(db);
|
|
59
|
+
await sql`
|
|
60
|
+
do $$
|
|
61
|
+
begin
|
|
62
|
+
if exists (select 1 from pg_roles where rolname = 'application') then
|
|
63
|
+
grant select, insert, update, delete
|
|
64
|
+
on accounting.contact_bank_details_request to application;
|
|
65
|
+
end if;
|
|
66
|
+
end;
|
|
67
|
+
$$
|
|
68
|
+
`.execute(db);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
72
|
+
await sql`drop table if exists accounting.contact_bank_details_request`.execute(
|
|
73
|
+
db
|
|
74
|
+
);
|
|
75
|
+
await sql`drop type if exists accounting.bank_details_request_delivery`.execute(
|
|
76
|
+
db
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19507: Ramp's customer-friendly payment id (PAY#), assigned after submit.
|
|
5
|
+
// Expand only; code that predates it ignores it. Not an instruction column, so
|
|
6
|
+
// the immutability trigger of migration 0071 lets it be set later.
|
|
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`
|
|
12
|
+
alter table accounting.payment
|
|
13
|
+
add column if not exists provider_reference text
|
|
14
|
+
`.execute(db);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
18
|
+
await sql`
|
|
19
|
+
alter table accounting.payment
|
|
20
|
+
drop column if exists provider_reference
|
|
21
|
+
`.execute(db);
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19526: Mark as unpaid and a changed paid date or account undo an offline payment by
|
|
5
|
+
// removing its journal rows instead of posting a reversing entry. Expand only; older code
|
|
6
|
+
// never writes the new value.
|
|
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`
|
|
12
|
+
alter type accounting.payment_reversal_kind add value if not exists 'offlineUndo'
|
|
13
|
+
`.execute(db);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function down(_db: Kysely<unknown>): Promise<void> {
|
|
17
|
+
// PostgreSQL enum values cannot be removed safely without rebuilding the type.
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// GET /reservations counts by status and stay overlap (`dateField=intersection`)
|
|
5
|
+
// without a listing. The only index that holds both dates leads with listing_id,
|
|
6
|
+
// so Postgres skip-scanned it once per listing: 6.4 s for one US team. On large
|
|
7
|
+
// databases run scripts/ben-2/pro-19581-create-reservation-index.ts first: it
|
|
8
|
+
// builds the index concurrently, and this migration then skips it.
|
|
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 = '30min'`.execute(db);
|
|
12
|
+
// A failed concurrent build leaves an invalid index that `if not exists`
|
|
13
|
+
// would keep, so drop it first.
|
|
14
|
+
const invalid = await sql<{ invalid: boolean }>`
|
|
15
|
+
select not (i.indisvalid and i.indisready) as invalid
|
|
16
|
+
from pg_index as i
|
|
17
|
+
inner join pg_class as index_class on index_class.oid = i.indexrelid
|
|
18
|
+
where index_class.relname = 'reservation_tenant_status_effective_check_out_idx'
|
|
19
|
+
`.execute(db);
|
|
20
|
+
if (invalid.rows[0]?.invalid) {
|
|
21
|
+
await sql`
|
|
22
|
+
drop index public.reservation_tenant_status_effective_check_out_idx
|
|
23
|
+
`.execute(db);
|
|
24
|
+
}
|
|
25
|
+
await sql`
|
|
26
|
+
create index if not exists reservation_tenant_status_effective_check_out_idx
|
|
27
|
+
on public.reservation (tenant_id, status, effective_check_out, effective_check_in)
|
|
28
|
+
`.execute(db);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
32
|
+
await sql`set local lock_timeout = '5s'`.execute(db);
|
|
33
|
+
await sql`set local statement_timeout = '60s'`.execute(db);
|
|
34
|
+
await sql`
|
|
35
|
+
drop index if exists public.reservation_tenant_status_effective_check_out_idx
|
|
36
|
+
`.execute(db);
|
|
37
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// P-PRO-983: Nacha files and printed checks. Expand only; no existing code reads or writes
|
|
5
|
+
// these tables. Funding bank numbers and Nacha entry snapshots hold full account numbers, so
|
|
6
|
+
// they live in their own tables that account reads, copies and exports never select.
|
|
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`
|
|
12
|
+
create type accounting.nacha_bank_profile as enum (
|
|
13
|
+
'generic', 'hancockWhitney', 'bmo', 'regions'
|
|
14
|
+
)
|
|
15
|
+
`.execute(db);
|
|
16
|
+
await sql`
|
|
17
|
+
create type accounting.nacha_sec_code as enum ('PPD', 'CCD')
|
|
18
|
+
`.execute(db);
|
|
19
|
+
await sql`
|
|
20
|
+
create type accounting.check_print_mode as enum ('plainPaper', 'preprinted')
|
|
21
|
+
`.execute(db);
|
|
22
|
+
await sql`
|
|
23
|
+
create type accounting.check_format as enum ('voucher', 'standard')
|
|
24
|
+
`.execute(db);
|
|
25
|
+
await sql`
|
|
26
|
+
create type accounting.payment_batch_type as enum ('nacha', 'check')
|
|
27
|
+
`.execute(db);
|
|
28
|
+
|
|
29
|
+
await sql`
|
|
30
|
+
create table accounting.account_payment_file_setting (
|
|
31
|
+
account_id uuid primary key references accounting.account (id) on delete cascade,
|
|
32
|
+
tenant_id uuid not null references public.tenant (id) on delete restrict,
|
|
33
|
+
bank_name text null check (bank_name is null or length(bank_name) between 1 and 100),
|
|
34
|
+
routing_number text null check (routing_number ~ '^[0-9]{9}$'),
|
|
35
|
+
account_number text null check (account_number ~ '^[0-9]{4,17}$'),
|
|
36
|
+
account_kind accounting.bank_account_kind null,
|
|
37
|
+
company_name text null
|
|
38
|
+
check (company_name is null or length(company_name) between 1 and 100),
|
|
39
|
+
company_address jsonb null
|
|
40
|
+
check (company_address is null or jsonb_typeof(company_address) = 'object'),
|
|
41
|
+
nacha_enabled boolean not null default false,
|
|
42
|
+
nacha_bank_profile accounting.nacha_bank_profile null,
|
|
43
|
+
nacha_immediate_destination text null
|
|
44
|
+
check (nacha_immediate_destination ~ '^[0-9]{9}$'),
|
|
45
|
+
nacha_immediate_destination_name text null
|
|
46
|
+
check (nacha_immediate_destination_name is null
|
|
47
|
+
or length(nacha_immediate_destination_name) between 1 and 23),
|
|
48
|
+
nacha_immediate_origin text null
|
|
49
|
+
check (nacha_immediate_origin ~ '^[0-9A-Za-z ]{1,10}$'),
|
|
50
|
+
nacha_immediate_origin_name text null
|
|
51
|
+
check (nacha_immediate_origin_name is null
|
|
52
|
+
or length(nacha_immediate_origin_name) between 1 and 23),
|
|
53
|
+
nacha_company_id text null
|
|
54
|
+
check (nacha_company_id ~ '^[0-9A-Za-z ]{1,10}$'),
|
|
55
|
+
nacha_company_name text null
|
|
56
|
+
check (nacha_company_name is null or length(nacha_company_name) between 1 and 16),
|
|
57
|
+
nacha_entry_description text null
|
|
58
|
+
check (nacha_entry_description is null
|
|
59
|
+
or length(nacha_entry_description) between 1 and 10),
|
|
60
|
+
nacha_discretionary_data text null
|
|
61
|
+
check (nacha_discretionary_data is null
|
|
62
|
+
or length(nacha_discretionary_data) between 1 and 20),
|
|
63
|
+
nacha_offset_entry boolean not null default false,
|
|
64
|
+
nacha_accept_canadian boolean not null default false,
|
|
65
|
+
nacha_test_file_at timestamptz null,
|
|
66
|
+
nacha_test_file_valid boolean null,
|
|
67
|
+
check_enabled boolean not null default false,
|
|
68
|
+
check_print_mode accounting.check_print_mode null,
|
|
69
|
+
check_format accounting.check_format null,
|
|
70
|
+
check_next_number integer null check (check_next_number between 1 and 99999999),
|
|
71
|
+
check_offset_x integer not null default 0 check (check_offset_x between -100 and 100),
|
|
72
|
+
check_offset_y integer not null default 0 check (check_offset_y between -100 and 100),
|
|
73
|
+
updated_by_user_id uuid null references public.user (id) on delete set null,
|
|
74
|
+
created_at timestamptz not null default now(),
|
|
75
|
+
updated_at timestamptz not null default now(),
|
|
76
|
+
check (num_nonnulls(nacha_test_file_at, nacha_test_file_valid) in (0, 2))
|
|
77
|
+
)
|
|
78
|
+
`.execute(db);
|
|
79
|
+
await sql`
|
|
80
|
+
create index account_payment_file_setting_tenant_id_idx
|
|
81
|
+
on accounting.account_payment_file_setting (tenant_id)
|
|
82
|
+
`.execute(db);
|
|
83
|
+
|
|
84
|
+
await sql`
|
|
85
|
+
create table accounting.payment_batch (
|
|
86
|
+
id uuid primary key default gen_random_uuid(),
|
|
87
|
+
tenant_id uuid not null references public.tenant (id) on delete restrict,
|
|
88
|
+
type accounting.payment_batch_type not null,
|
|
89
|
+
account_id uuid not null references accounting.account (id) on delete restrict,
|
|
90
|
+
currency text not null references public.currency (name),
|
|
91
|
+
effective_date date not null,
|
|
92
|
+
settings jsonb not null check (jsonb_typeof(settings) = 'object'),
|
|
93
|
+
file_content text null,
|
|
94
|
+
file_updated_at timestamptz null,
|
|
95
|
+
created_by_user_id uuid null references public.user (id) on delete set null,
|
|
96
|
+
idempotency_key text not null check (length(idempotency_key) between 1 and 200),
|
|
97
|
+
voided_at timestamptz null,
|
|
98
|
+
created_at timestamptz not null default now(),
|
|
99
|
+
updated_at timestamptz not null default now(),
|
|
100
|
+
unique (tenant_id, idempotency_key),
|
|
101
|
+
check ((type = 'nacha') = (file_content is not null))
|
|
102
|
+
)
|
|
103
|
+
`.execute(db);
|
|
104
|
+
await sql`
|
|
105
|
+
create index payment_batch_tenant_created_idx
|
|
106
|
+
on accounting.payment_batch (tenant_id, created_at desc)
|
|
107
|
+
`.execute(db);
|
|
108
|
+
await sql`
|
|
109
|
+
create index payment_batch_account_idx
|
|
110
|
+
on accounting.payment_batch (tenant_id, account_id)
|
|
111
|
+
`.execute(db);
|
|
112
|
+
|
|
113
|
+
await sql`
|
|
114
|
+
create table accounting.payment_batch_item (
|
|
115
|
+
id uuid primary key default gen_random_uuid(),
|
|
116
|
+
tenant_id uuid not null references public.tenant (id) on delete restrict,
|
|
117
|
+
batch_id uuid not null references accounting.payment_batch (id) on delete restrict,
|
|
118
|
+
account_id uuid not null references accounting.account (id) on delete restrict,
|
|
119
|
+
contact_id uuid not null references accounting.contact (id) on delete restrict,
|
|
120
|
+
amount integer not null check (amount > 0),
|
|
121
|
+
payee_name text not null check (length(payee_name) between 1 and 200),
|
|
122
|
+
payee_address jsonb null
|
|
123
|
+
check (payee_address is null or jsonb_typeof(payee_address) = 'object'),
|
|
124
|
+
memo text null check (memo is null or length(memo) <= 200),
|
|
125
|
+
stub jsonb not null check (jsonb_typeof(stub) = 'array'),
|
|
126
|
+
check_number integer null check (check_number between 1 and 99999999),
|
|
127
|
+
sec_code accounting.nacha_sec_code null,
|
|
128
|
+
routing_number text null check (routing_number ~ '^[0-9]{9}$'),
|
|
129
|
+
account_number text null check (account_number ~ '^[0-9]{4,17}$'),
|
|
130
|
+
account_kind accounting.bank_account_kind null,
|
|
131
|
+
trace_number text null check (trace_number ~ '^[0-9]{15}$'),
|
|
132
|
+
voided_at timestamptz null,
|
|
133
|
+
created_at timestamptz not null default now(),
|
|
134
|
+
check (
|
|
135
|
+
num_nonnulls(sec_code, routing_number, account_number, account_kind) in (0, 4)
|
|
136
|
+
),
|
|
137
|
+
check (check_number is null or sec_code is null)
|
|
138
|
+
)
|
|
139
|
+
`.execute(db);
|
|
140
|
+
// Voided check numbers keep their row, so a number is never printed twice.
|
|
141
|
+
await sql`
|
|
142
|
+
create unique index payment_batch_item_check_number_idx
|
|
143
|
+
on accounting.payment_batch_item (tenant_id, account_id, check_number)
|
|
144
|
+
where check_number is not null
|
|
145
|
+
`.execute(db);
|
|
146
|
+
await sql`
|
|
147
|
+
create index payment_batch_item_batch_idx
|
|
148
|
+
on accounting.payment_batch_item (tenant_id, batch_id)
|
|
149
|
+
`.execute(db);
|
|
150
|
+
await sql`
|
|
151
|
+
create index payment_batch_item_contact_idx
|
|
152
|
+
on accounting.payment_batch_item (tenant_id, contact_id)
|
|
153
|
+
`.execute(db);
|
|
154
|
+
|
|
155
|
+
await sql`
|
|
156
|
+
create table accounting.payment_batch_payment (
|
|
157
|
+
payment_id uuid primary key references accounting.payment (id) on delete restrict,
|
|
158
|
+
tenant_id uuid not null references public.tenant (id) on delete restrict,
|
|
159
|
+
item_id uuid not null references accounting.payment_batch_item (id) on delete restrict,
|
|
160
|
+
created_at timestamptz not null default now()
|
|
161
|
+
)
|
|
162
|
+
`.execute(db);
|
|
163
|
+
await sql`
|
|
164
|
+
create index payment_batch_payment_item_idx
|
|
165
|
+
on accounting.payment_batch_payment (tenant_id, item_id)
|
|
166
|
+
`.execute(db);
|
|
167
|
+
|
|
168
|
+
await sql`
|
|
169
|
+
do $$
|
|
170
|
+
begin
|
|
171
|
+
if exists (select 1 from pg_roles where rolname = 'application') then
|
|
172
|
+
grant select, insert, update, delete on
|
|
173
|
+
accounting.account_payment_file_setting,
|
|
174
|
+
accounting.payment_batch,
|
|
175
|
+
accounting.payment_batch_item,
|
|
176
|
+
accounting.payment_batch_payment
|
|
177
|
+
to application;
|
|
178
|
+
end if;
|
|
179
|
+
end;
|
|
180
|
+
$$
|
|
181
|
+
`.execute(db);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
185
|
+
await sql`drop table if exists accounting.payment_batch_payment`.execute(db);
|
|
186
|
+
await sql`drop table if exists accounting.payment_batch_item`.execute(db);
|
|
187
|
+
await sql`drop table if exists accounting.payment_batch`.execute(db);
|
|
188
|
+
await sql`drop table if exists accounting.account_payment_file_setting`.execute(
|
|
189
|
+
db
|
|
190
|
+
);
|
|
191
|
+
await sql`drop type if exists accounting.payment_batch_type`.execute(db);
|
|
192
|
+
await sql`drop type if exists accounting.check_format`.execute(db);
|
|
193
|
+
await sql`drop type if exists accounting.check_print_mode`.execute(db);
|
|
194
|
+
await sql`drop type if exists accounting.nacha_sec_code`.execute(db);
|
|
195
|
+
await sql`drop type if exists accounting.nacha_bank_profile`.execute(db);
|
|
196
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
const codes = [
|
|
5
|
+
'listingsNeedSetup',
|
|
6
|
+
'unmappedReservationLineTypes',
|
|
7
|
+
'bankRecordsWithSuggestedMatch',
|
|
8
|
+
'unmatchedBankDeposits',
|
|
9
|
+
'unmatchedBankExpenses',
|
|
10
|
+
'unreconciledBankTransactions',
|
|
11
|
+
'unassignedGuestDeposits',
|
|
12
|
+
'departedReservationBalanceMismatch',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
16
|
+
// Expand storage only. The codes must be writable on every channel before
|
|
17
|
+
// API producers mark them dirty in shared regional databases.
|
|
18
|
+
for (const code of codes) {
|
|
19
|
+
await sql`alter type health.tenant_issue_code add value if not exists ${sql.lit(code)}`.execute(
|
|
20
|
+
db
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// PostgreSQL enum additions are retained so historical issues remain readable.
|
|
26
|
+
export async function down(_db: Kysely<unknown>): Promise<void> {}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19673: VRPilot line mapping suggestions are mapping rows with is_suggestion true.
|
|
5
|
+
// Expand only; existing writers leave the new columns at their defaults, which satisfy the
|
|
6
|
+
// check. Readers must treat suggestion rows as unmapped before any suggestion is written.
|
|
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`
|
|
12
|
+
create type accounting.reservation_line_mapping_suggestion_source as enum (
|
|
13
|
+
'rule', 'llm'
|
|
14
|
+
)
|
|
15
|
+
`.execute(db);
|
|
16
|
+
await sql`
|
|
17
|
+
alter table accounting.account_reservation_line_type
|
|
18
|
+
add column is_suggestion boolean not null default false,
|
|
19
|
+
add column suggestion_reason text null,
|
|
20
|
+
add column suggestion_source
|
|
21
|
+
accounting.reservation_line_mapping_suggestion_source null,
|
|
22
|
+
add constraint account_reservation_line_type_suggestion_shape check (
|
|
23
|
+
(
|
|
24
|
+
is_suggestion
|
|
25
|
+
and suggestion_source is not null
|
|
26
|
+
and suggestion_reason is not null
|
|
27
|
+
and length(suggestion_reason) between 1 and 1000
|
|
28
|
+
)
|
|
29
|
+
or (
|
|
30
|
+
not is_suggestion
|
|
31
|
+
and suggestion_source is null
|
|
32
|
+
and suggestion_reason is null
|
|
33
|
+
)
|
|
34
|
+
) not valid
|
|
35
|
+
`.execute(db);
|
|
36
|
+
await sql`
|
|
37
|
+
alter table accounting.account_reservation_line_type
|
|
38
|
+
validate constraint account_reservation_line_type_suggestion_shape
|
|
39
|
+
`.execute(db);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
43
|
+
await sql`
|
|
44
|
+
alter table accounting.account_reservation_line_type
|
|
45
|
+
drop constraint if exists account_reservation_line_type_suggestion_shape,
|
|
46
|
+
drop column if exists suggestion_source,
|
|
47
|
+
drop column if exists suggestion_reason,
|
|
48
|
+
drop column if exists is_suggestion
|
|
49
|
+
`.execute(db);
|
|
50
|
+
await sql`
|
|
51
|
+
drop type if exists accounting.reservation_line_mapping_suggestion_source
|
|
52
|
+
`.execute(db);
|
|
53
|
+
}
|
|
@@ -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 'cancelledReservationBalances'`.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,28 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// PRO-19711: the bank details request whose emailed form link the payee used
|
|
5
|
+
// to enter the bank account, so the team sees the payee changed it. Expand
|
|
6
|
+
// only; code that predates it ignores the column.
|
|
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`
|
|
12
|
+
alter table accounting.contact_bank_account
|
|
13
|
+
add column if not exists updated_by_bank_details_request_id uuid
|
|
14
|
+
references accounting.contact_bank_details_request (id)
|
|
15
|
+
on delete set null
|
|
16
|
+
`.execute(db);
|
|
17
|
+
await sql`
|
|
18
|
+
create index if not exists contact_bank_account_updated_by_request_idx
|
|
19
|
+
on accounting.contact_bank_account (updated_by_bank_details_request_id)
|
|
20
|
+
`.execute(db);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
24
|
+
await sql`
|
|
25
|
+
alter table accounting.contact_bank_account
|
|
26
|
+
drop column if exists updated_by_bank_details_request_id
|
|
27
|
+
`.execute(db);
|
|
28
|
+
}
|