@valentine-efagene/qshelter-common 2.0.157 → 2.0.158
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/dist/generated/client/browser.d.ts +1 -1
- package/dist/generated/client/client.d.ts +1 -1
- package/dist/generated/client/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +2 -4
- package/dist/generated/client/internal/prismaNamespace.js +2 -4
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +2 -4
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +2 -4
- package/dist/generated/client/models/BankDocumentRequirement.d.ts +90 -154
- package/dist/generated/client/models/PropertyPaymentMethod.d.ts +3 -192
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +227 -4
- package/package.json +1 -1
- package/prisma/migrations/0_init/migration.sql +2327 -0
- package/prisma/schema.prisma +17 -18
- package/prisma/migrations/20251228081517_create_initial_tables/migration.sql +0 -707
- package/prisma/migrations/20251228083337_refresh_token_hash/migration.sql +0 -16
- package/prisma/migrations/20251228084551/migration.sql +0 -16
- package/prisma/migrations/20251230104059_add_property_variants/migration.sql +0 -622
- package/prisma/migrations/20251230113413_add_multitenancy/migration.sql +0 -54
- package/prisma/migrations/20251230231217_add_prequalification_and_payment_method_change/migration.sql +0 -137
- package/prisma/migrations/20260101081428_normalize_schema/migration.sql +0 -119
- package/prisma/migrations/20260101102022_add_contract_termination/migration.sql +0 -69
- package/prisma/migrations/20260101110958_add_collect_funds/migration.sql +0 -8
- package/prisma/migrations/20260104084843_add_document_templates_and_offer_letters/migration.sql +0 -77
- package/prisma/migrations/20260104095131_add_underwriting_decision/migration.sql +0 -31
- package/prisma/migrations/20260104170149_add_generate_document_step_type/migration.sql +0 -5
- package/prisma/migrations/20260104172349_add_metadata_to_contract_phase_step/migration.sql +0 -2
- package/prisma/migrations/20260104174626_make_offer_letter_template_optional/migration.sql +0 -11
- package/prisma/migrations/20260105004059_add_superseded_phase_status/migration.sql +0 -2
- package/prisma/migrations/20260105074701_add_underwriting_step_types/migration.sql +0 -17
- package/prisma/migrations/20260105080236_remove_prequalification_model/migration.sql +0 -37
- package/prisma/migrations/20260105081842_unify_contract_events/migration.sql +0 -37
- package/prisma/migrations/20260105085337_simplify_los_remove_prequalification/migration.sql +0 -1
- package/prisma/migrations/20260105094604_workflow_tracking_current_step/migration.sql +0 -14
- package/prisma/migrations/20260105130633_add_api_keys/migration.sql +0 -26
- package/prisma/migrations/20260105151535_add_event_workflow_system/migration.sql +0 -132
- package/prisma/migrations/20260105160757_add_sns_handler_type/migration.sql +0 -2
- package/prisma/migrations/20260106003757_business_friendly_handler_types/migration.sql +0 -28
- package/prisma/migrations/20260106062140_add_step_event_attachments/migration.sql +0 -22
- package/prisma/migrations/20260107121844_add_property_transfer_requests/migration.sql +0 -64
- package/prisma/migrations/20260107172301_add_approval_request_model/migration.sql +0 -46
- package/prisma/migrations/20260107214834_add_contract_refund_model/migration.sql +0 -64
- package/prisma/migrations/20260108051928_add_approval_request_type_status_index/migration.sql +0 -2
- package/prisma/migrations/20260109132751_update_transfer_flow/migration.sql +0 -343
- package/prisma/migrations/20260111091027_rbac_redesign_federated_users/migration.sql +0 -79
- package/prisma/migrations/20260112000006_add_phase_event_attachments/migration.sql +0 -22
- package/prisma/migrations/20260112041159_add_flexible_term_configuration/migration.sql +0 -11
- package/prisma/migrations/20260112080730_rename_contract_to_application/migration.sql +0 -293
- package/prisma/migrations/20260112081422_cleanup_rename_contract_to_application/migration.sql +0 -14
- package/prisma/migrations/20260113000000_remove_workflow_analytics_summary/migration.sql +0 -5
- package/prisma/migrations/20260113110450_add_tenant_id_to_child_models/migration.sql +0 -334
- package/prisma/migrations/20260113122855_add_tenant_to_remaining_models/migration.sql +0 -64
- package/prisma/migrations/20260114034523_add_documentation_plan/migration.sql +0 -52
- package/prisma/migrations/20260114053042_add_questionnaire_plan/migration.sql +0 -73
- package/prisma/migrations/20260114164044_add_condition_to_documentation_plan_step/migration.sql +0 -10
- package/prisma/migrations/20260115055636_add_unit_locking/migration.sql +0 -16
- package/prisma/migrations/20260115060132_add_phase_template_reference/migration.sql +0 -8
- package/prisma/migrations/20260115084033_add_gate_step_type/migration.sql +0 -29
- package/prisma/migrations/20260115123703_add_organizations/migration.sql +0 -69
- package/prisma/migrations/20260115125519_add_requires_manual_review_to_step/migration.sql +0 -2
- package/prisma/migrations/20260115134106_add_conditional_step_support/migration.sql +0 -11
- package/prisma/migrations/20260116090633_add_question_category_enum/migration.sql +0 -8
- package/prisma/migrations/20260116152051_add_multi_party_document_review/migration.sql +0 -59
- package/prisma/migrations/20260116153745_add_platform_organization_type/migration.sql +0 -3
- package/prisma/migrations/20260119180401_add_document_name_remove_required_doc_types/migration.sql +0 -14
- package/prisma/migrations/20260119190336_add_document_approval_workflow/migration.sql +0 -134
- package/prisma/migrations/20260120024650_add_questionnaire_phase_review/migration.sql +0 -102
- package/prisma/migrations/20260121155057_add_event_execution_and_bank_docs/migration.sql +0 -198
- package/prisma/migrations/20260121161937_add_phase_step_order_unique_constraints/migration.sql +0 -12
- package/prisma/migrations/20260121163910_add_optimistic_locking/migration.sql +0 -14
- package/prisma/migrations/20260125090213_remove_is_published_use_status_enum/migration.sql +0 -10
- package/prisma/migrations/20260125102448_org_types_many_to_many/migration.sql +0 -153
- package/prisma/migrations/20260125103700_20260125102448_org_types_many_to_many_fix/migration.sql +0 -5
- package/prisma/migrations/20260126031132_add_organization_id_to_property/migration.sql +0 -8
- package/prisma/migrations/migration_lock.toml +0 -3
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
-- Safe Migration: Rename Contract to Application
|
|
2
|
-
-- This migration uses RENAME TABLE and RENAME COLUMN to preserve data
|
|
3
|
-
|
|
4
|
-
-- Step 1: Update enum values in approval_requests
|
|
5
|
-
ALTER TABLE `approval_requests` MODIFY `type` ENUM('PROPERTY_TRANSFER', 'PROPERTY_UPDATE', 'USER_WORKFLOW', 'CREDIT_CHECK', 'CONTRACT_TERMINATION', 'APPLICATION_TERMINATION', 'REFUND_APPROVAL') NOT NULL;
|
|
6
|
-
UPDATE `approval_requests` SET `type` = 'APPLICATION_TERMINATION' WHERE `type` = 'CONTRACT_TERMINATION';
|
|
7
|
-
ALTER TABLE `approval_requests` MODIFY `type` ENUM('PROPERTY_TRANSFER', 'PROPERTY_UPDATE', 'USER_WORKFLOW', 'CREDIT_CHECK', 'APPLICATION_TERMINATION', 'REFUND_APPROVAL') NOT NULL;
|
|
8
|
-
|
|
9
|
-
-- Step 2: Update enum values in document_requirement_rules
|
|
10
|
-
ALTER TABLE `document_requirement_rules` MODIFY `context` ENUM('CONTRACT_PHASE', 'APPLICATION_PHASE', 'PAYMENT_METHOD_CHANGE') NOT NULL;
|
|
11
|
-
UPDATE `document_requirement_rules` SET `context` = 'APPLICATION_PHASE' WHERE `context` = 'CONTRACT_PHASE';
|
|
12
|
-
ALTER TABLE `document_requirement_rules` MODIFY `context` ENUM('APPLICATION_PHASE', 'PAYMENT_METHOD_CHANGE') NOT NULL;
|
|
13
|
-
|
|
14
|
-
-- Step 3: Drop existing foreign keys that reference contract tables
|
|
15
|
-
-- contracts table foreign keys
|
|
16
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_tenantId_fkey`;
|
|
17
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_propertyUnitId_fkey`;
|
|
18
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_buyerId_fkey`;
|
|
19
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_sellerId_fkey`;
|
|
20
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_paymentMethodId_fkey`;
|
|
21
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_currentPhaseId_fkey`;
|
|
22
|
-
ALTER TABLE `contracts` DROP FOREIGN KEY `contracts_transferredFromId_fkey`;
|
|
23
|
-
|
|
24
|
-
-- contract_phases foreign keys
|
|
25
|
-
ALTER TABLE `contract_phases` DROP FOREIGN KEY `contract_phases_contractId_fkey`;
|
|
26
|
-
|
|
27
|
-
-- contract_events foreign keys
|
|
28
|
-
ALTER TABLE `contract_events` DROP FOREIGN KEY `contract_events_contractId_fkey`;
|
|
29
|
-
|
|
30
|
-
-- contract_payments foreign keys
|
|
31
|
-
ALTER TABLE `contract_payments` DROP FOREIGN KEY `contract_payments_contractId_fkey`;
|
|
32
|
-
ALTER TABLE `contract_payments` DROP FOREIGN KEY `contract_payments_phaseId_fkey`;
|
|
33
|
-
ALTER TABLE `contract_payments` DROP FOREIGN KEY `contract_payments_installmentId_fkey`;
|
|
34
|
-
ALTER TABLE `contract_payments` DROP FOREIGN KEY `contract_payments_payerId_fkey`;
|
|
35
|
-
|
|
36
|
-
-- contract_documents foreign keys
|
|
37
|
-
ALTER TABLE `contract_documents` DROP FOREIGN KEY `contract_documents_contractId_fkey`;
|
|
38
|
-
ALTER TABLE `contract_documents` DROP FOREIGN KEY `contract_documents_uploadedById_fkey`;
|
|
39
|
-
|
|
40
|
-
-- contract_refunds foreign keys
|
|
41
|
-
ALTER TABLE `contract_refunds` DROP FOREIGN KEY `contract_refunds_tenantId_fkey`;
|
|
42
|
-
ALTER TABLE `contract_refunds` DROP FOREIGN KEY `contract_refunds_contractId_fkey`;
|
|
43
|
-
ALTER TABLE `contract_refunds` DROP FOREIGN KEY `contract_refunds_requestedById_fkey`;
|
|
44
|
-
ALTER TABLE `contract_refunds` DROP FOREIGN KEY `contract_refunds_approvedById_fkey`;
|
|
45
|
-
ALTER TABLE `contract_refunds` DROP FOREIGN KEY `contract_refunds_processedById_fkey`;
|
|
46
|
-
|
|
47
|
-
-- contract_terminations foreign keys
|
|
48
|
-
ALTER TABLE `contract_terminations` DROP FOREIGN KEY `contract_terminations_contractId_fkey`;
|
|
49
|
-
ALTER TABLE `contract_terminations` DROP FOREIGN KEY `contract_terminations_tenantId_fkey`;
|
|
50
|
-
ALTER TABLE `contract_terminations` DROP FOREIGN KEY `contract_terminations_initiatorId_fkey`;
|
|
51
|
-
ALTER TABLE `contract_terminations` DROP FOREIGN KEY `contract_terminations_reviewedBy_fkey`;
|
|
52
|
-
|
|
53
|
-
-- contract_installments foreign keys
|
|
54
|
-
ALTER TABLE `contract_installments` DROP FOREIGN KEY `contract_installments_paymentPhaseId_fkey`;
|
|
55
|
-
|
|
56
|
-
-- other tables referencing contracts
|
|
57
|
-
ALTER TABLE `offer_letters` DROP FOREIGN KEY `offer_letters_contractId_fkey`;
|
|
58
|
-
ALTER TABLE `payment_method_change_requests` DROP FOREIGN KEY `payment_method_change_requests_contractId_fkey`;
|
|
59
|
-
ALTER TABLE `property_transfer_requests` DROP FOREIGN KEY `property_transfer_requests_sourceContractId_fkey`;
|
|
60
|
-
ALTER TABLE `property_transfer_requests` DROP FOREIGN KEY `property_transfer_requests_targetContractId_fkey`;
|
|
61
|
-
|
|
62
|
-
-- questionnaire_phases, documentation_phases, payment_phases reference contract_phases
|
|
63
|
-
ALTER TABLE `questionnaire_phases` DROP FOREIGN KEY `questionnaire_phases_phaseId_fkey`;
|
|
64
|
-
ALTER TABLE `documentation_phases` DROP FOREIGN KEY `documentation_phases_phaseId_fkey`;
|
|
65
|
-
ALTER TABLE `payment_phases` DROP FOREIGN KEY `payment_phases_phaseId_fkey`;
|
|
66
|
-
|
|
67
|
-
-- Step 4: Rename tables
|
|
68
|
-
RENAME TABLE `contracts` TO `applications`;
|
|
69
|
-
RENAME TABLE `contract_phases` TO `application_phases`;
|
|
70
|
-
RENAME TABLE `contract_events` TO `application_events`;
|
|
71
|
-
RENAME TABLE `contract_payments` TO `application_payments`;
|
|
72
|
-
RENAME TABLE `contract_documents` TO `application_documents`;
|
|
73
|
-
RENAME TABLE `contract_refunds` TO `application_refunds`;
|
|
74
|
-
RENAME TABLE `contract_terminations` TO `application_terminations`;
|
|
75
|
-
RENAME TABLE `contract_installments` TO `payment_installments`;
|
|
76
|
-
|
|
77
|
-
-- Step 5: Rename columns in applications table
|
|
78
|
-
ALTER TABLE `applications` CHANGE `contractNumber` `applicationNumber` VARCHAR(191) NOT NULL;
|
|
79
|
-
ALTER TABLE `applications` CHANGE `contractType` `applicationType` VARCHAR(191) NOT NULL;
|
|
80
|
-
|
|
81
|
-
-- Step 6: Rename columns in related tables (contractId -> applicationId)
|
|
82
|
-
ALTER TABLE `application_phases` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
83
|
-
ALTER TABLE `application_events` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
84
|
-
ALTER TABLE `application_payments` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
85
|
-
ALTER TABLE `application_documents` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
86
|
-
ALTER TABLE `application_refunds` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
87
|
-
ALTER TABLE `application_terminations` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
88
|
-
|
|
89
|
-
-- Rename columns in other tables that reference contracts
|
|
90
|
-
ALTER TABLE `offer_letters` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
91
|
-
ALTER TABLE `payment_method_change_requests` CHANGE `contractId` `applicationId` VARCHAR(191) NOT NULL;
|
|
92
|
-
ALTER TABLE `property_transfer_requests` CHANGE `sourceContractId` `sourceApplicationId` VARCHAR(191) NOT NULL;
|
|
93
|
-
ALTER TABLE `property_transfer_requests` CHANGE `targetContractId` `targetApplicationId` VARCHAR(191) NULL;
|
|
94
|
-
|
|
95
|
-
-- Step 7: Update enum for application_events.eventType
|
|
96
|
-
-- First add new values, then update, then remove old values
|
|
97
|
-
ALTER TABLE `application_events` MODIFY `eventType` ENUM(
|
|
98
|
-
'CONTRACT_CREATED', 'CONTRACT_STATE_CHANGED',
|
|
99
|
-
'APPLICATION_CREATED', 'APPLICATION_STATE_CHANGED',
|
|
100
|
-
'PHASE_ACTIVATED', 'PHASE_COMPLETED', 'STEP_COMPLETED', 'STEP_REJECTED',
|
|
101
|
-
'DOCUMENT_SUBMITTED', 'DOCUMENT_APPROVED', 'DOCUMENT_REJECTED',
|
|
102
|
-
'PAYMENT_INITIATED', 'PAYMENT_COMPLETED', 'PAYMENT_FAILED', 'INSTALLMENTS_GENERATED',
|
|
103
|
-
'CONTRACT_SIGNED', 'CONTRACT_TERMINATED', 'CONTRACT_TRANSFERRED',
|
|
104
|
-
'APPLICATION_SIGNED', 'APPLICATION_TERMINATED', 'APPLICATION_TRANSFERRED',
|
|
105
|
-
'UNDERWRITING_COMPLETED', 'OFFER_LETTER_GENERATED'
|
|
106
|
-
) NOT NULL;
|
|
107
|
-
|
|
108
|
-
UPDATE `application_events` SET `eventType` = 'APPLICATION_CREATED' WHERE `eventType` = 'CONTRACT_CREATED';
|
|
109
|
-
UPDATE `application_events` SET `eventType` = 'APPLICATION_STATE_CHANGED' WHERE `eventType` = 'CONTRACT_STATE_CHANGED';
|
|
110
|
-
UPDATE `application_events` SET `eventType` = 'APPLICATION_SIGNED' WHERE `eventType` = 'CONTRACT_SIGNED';
|
|
111
|
-
UPDATE `application_events` SET `eventType` = 'APPLICATION_TERMINATED' WHERE `eventType` = 'CONTRACT_TERMINATED';
|
|
112
|
-
UPDATE `application_events` SET `eventType` = 'APPLICATION_TRANSFERRED' WHERE `eventType` = 'CONTRACT_TRANSFERRED';
|
|
113
|
-
|
|
114
|
-
ALTER TABLE `application_events` MODIFY `eventType` ENUM(
|
|
115
|
-
'APPLICATION_CREATED', 'APPLICATION_STATE_CHANGED',
|
|
116
|
-
'PHASE_ACTIVATED', 'PHASE_COMPLETED', 'STEP_COMPLETED', 'STEP_REJECTED',
|
|
117
|
-
'DOCUMENT_SUBMITTED', 'DOCUMENT_APPROVED', 'DOCUMENT_REJECTED',
|
|
118
|
-
'PAYMENT_INITIATED', 'PAYMENT_COMPLETED', 'PAYMENT_FAILED', 'INSTALLMENTS_GENERATED',
|
|
119
|
-
'APPLICATION_SIGNED', 'APPLICATION_TERMINATED', 'APPLICATION_TRANSFERRED',
|
|
120
|
-
'UNDERWRITING_COMPLETED', 'OFFER_LETTER_GENERATED'
|
|
121
|
-
) NOT NULL;
|
|
122
|
-
|
|
123
|
-
-- Step 8: Drop old indexes
|
|
124
|
-
DROP INDEX `contracts_contractNumber_key` ON `applications`;
|
|
125
|
-
DROP INDEX `contracts_transferredFromId_key` ON `applications`;
|
|
126
|
-
DROP INDEX `contracts_tenantId_idx` ON `applications`;
|
|
127
|
-
DROP INDEX `contracts_propertyUnitId_idx` ON `applications`;
|
|
128
|
-
DROP INDEX `contracts_buyerId_idx` ON `applications`;
|
|
129
|
-
DROP INDEX `contracts_sellerId_idx` ON `applications`;
|
|
130
|
-
DROP INDEX `contracts_paymentMethodId_idx` ON `applications`;
|
|
131
|
-
DROP INDEX `contracts_status_idx` ON `applications`;
|
|
132
|
-
DROP INDEX `contracts_currentPhaseId_idx` ON `applications`;
|
|
133
|
-
|
|
134
|
-
DROP INDEX `contract_phases_contractId_idx` ON `application_phases`;
|
|
135
|
-
DROP INDEX `contract_phases_phaseCategory_idx` ON `application_phases`;
|
|
136
|
-
DROP INDEX `contract_phases_status_idx` ON `application_phases`;
|
|
137
|
-
DROP INDEX `contract_phases_order_idx` ON `application_phases`;
|
|
138
|
-
|
|
139
|
-
DROP INDEX `contract_events_contractId_idx` ON `application_events`;
|
|
140
|
-
DROP INDEX `contract_events_eventType_idx` ON `application_events`;
|
|
141
|
-
DROP INDEX `contract_events_eventGroup_idx` ON `application_events`;
|
|
142
|
-
DROP INDEX `contract_events_occurredAt_idx` ON `application_events`;
|
|
143
|
-
|
|
144
|
-
DROP INDEX `contract_payments_contractId_idx` ON `application_payments`;
|
|
145
|
-
DROP INDEX `contract_payments_phaseId_idx` ON `application_payments`;
|
|
146
|
-
DROP INDEX `contract_payments_installmentId_idx` ON `application_payments`;
|
|
147
|
-
DROP INDEX `contract_payments_payerId_idx` ON `application_payments`;
|
|
148
|
-
DROP INDEX `contract_payments_status_idx` ON `application_payments`;
|
|
149
|
-
DROP INDEX `contract_payments_reference_key` ON `application_payments`;
|
|
150
|
-
DROP INDEX `contract_payments_reference_idx` ON `application_payments`;
|
|
151
|
-
|
|
152
|
-
DROP INDEX `contract_documents_contractId_idx` ON `application_documents`;
|
|
153
|
-
DROP INDEX `contract_documents_phaseId_idx` ON `application_documents`;
|
|
154
|
-
DROP INDEX `contract_documents_stepId_idx` ON `application_documents`;
|
|
155
|
-
DROP INDEX `contract_documents_type_idx` ON `application_documents`;
|
|
156
|
-
DROP INDEX `contract_documents_status_idx` ON `application_documents`;
|
|
157
|
-
|
|
158
|
-
DROP INDEX `contract_refunds_contractId_idx` ON `application_refunds`;
|
|
159
|
-
DROP INDEX `contract_refunds_status_idx` ON `application_refunds`;
|
|
160
|
-
DROP INDEX `contract_refunds_tenantId_idx` ON `application_refunds`;
|
|
161
|
-
DROP INDEX `contract_refunds_requestedById_idx` ON `application_refunds`;
|
|
162
|
-
|
|
163
|
-
DROP INDEX `contract_terminations_contractId_idx` ON `application_terminations`;
|
|
164
|
-
DROP INDEX `contract_terminations_tenantId_idx` ON `application_terminations`;
|
|
165
|
-
DROP INDEX `contract_terminations_status_idx` ON `application_terminations`;
|
|
166
|
-
DROP INDEX `contract_terminations_type_idx` ON `application_terminations`;
|
|
167
|
-
DROP INDEX `contract_terminations_initiatorId_idx` ON `application_terminations`;
|
|
168
|
-
DROP INDEX `contract_terminations_requestedAt_idx` ON `application_terminations`;
|
|
169
|
-
DROP INDEX `contract_terminations_requestNumber_key` ON `application_terminations`;
|
|
170
|
-
DROP INDEX `contract_terminations_idempotencyKey_key` ON `application_terminations`;
|
|
171
|
-
|
|
172
|
-
DROP INDEX `contract_installments_paymentPhaseId_idx` ON `payment_installments`;
|
|
173
|
-
DROP INDEX `contract_installments_dueDate_idx` ON `payment_installments`;
|
|
174
|
-
DROP INDEX `contract_installments_status_idx` ON `payment_installments`;
|
|
175
|
-
|
|
176
|
-
DROP INDEX `offer_letters_contractId_idx` ON `offer_letters`;
|
|
177
|
-
DROP INDEX `payment_method_change_requests_contractId_idx` ON `payment_method_change_requests`;
|
|
178
|
-
DROP INDEX `property_transfer_requests_sourceContractId_idx` ON `property_transfer_requests`;
|
|
179
|
-
DROP INDEX `property_transfer_requests_targetContractId_fkey` ON `property_transfer_requests`;
|
|
180
|
-
|
|
181
|
-
-- Step 9: Create new indexes with new names
|
|
182
|
-
CREATE UNIQUE INDEX `applications_applicationNumber_key` ON `applications`(`applicationNumber`);
|
|
183
|
-
CREATE UNIQUE INDEX `applications_transferredFromId_key` ON `applications`(`transferredFromId`);
|
|
184
|
-
CREATE INDEX `applications_tenantId_idx` ON `applications`(`tenantId`);
|
|
185
|
-
CREATE INDEX `applications_propertyUnitId_idx` ON `applications`(`propertyUnitId`);
|
|
186
|
-
CREATE INDEX `applications_buyerId_idx` ON `applications`(`buyerId`);
|
|
187
|
-
CREATE INDEX `applications_sellerId_idx` ON `applications`(`sellerId`);
|
|
188
|
-
CREATE INDEX `applications_paymentMethodId_idx` ON `applications`(`paymentMethodId`);
|
|
189
|
-
CREATE INDEX `applications_status_idx` ON `applications`(`status`);
|
|
190
|
-
CREATE INDEX `applications_currentPhaseId_idx` ON `applications`(`currentPhaseId`);
|
|
191
|
-
|
|
192
|
-
CREATE INDEX `application_phases_applicationId_idx` ON `application_phases`(`applicationId`);
|
|
193
|
-
CREATE INDEX `application_phases_phaseCategory_idx` ON `application_phases`(`phaseCategory`);
|
|
194
|
-
CREATE INDEX `application_phases_status_idx` ON `application_phases`(`status`);
|
|
195
|
-
CREATE INDEX `application_phases_order_idx` ON `application_phases`(`order`);
|
|
196
|
-
|
|
197
|
-
CREATE INDEX `application_events_applicationId_idx` ON `application_events`(`applicationId`);
|
|
198
|
-
CREATE INDEX `application_events_eventType_idx` ON `application_events`(`eventType`);
|
|
199
|
-
CREATE INDEX `application_events_eventGroup_idx` ON `application_events`(`eventGroup`);
|
|
200
|
-
CREATE INDEX `application_events_occurredAt_idx` ON `application_events`(`occurredAt`);
|
|
201
|
-
|
|
202
|
-
CREATE INDEX `application_payments_applicationId_idx` ON `application_payments`(`applicationId`);
|
|
203
|
-
CREATE INDEX `application_payments_phaseId_idx` ON `application_payments`(`phaseId`);
|
|
204
|
-
CREATE INDEX `application_payments_installmentId_idx` ON `application_payments`(`installmentId`);
|
|
205
|
-
CREATE INDEX `application_payments_payerId_idx` ON `application_payments`(`payerId`);
|
|
206
|
-
CREATE INDEX `application_payments_status_idx` ON `application_payments`(`status`);
|
|
207
|
-
CREATE UNIQUE INDEX `application_payments_reference_key` ON `application_payments`(`reference`);
|
|
208
|
-
CREATE INDEX `application_payments_reference_idx` ON `application_payments`(`reference`);
|
|
209
|
-
|
|
210
|
-
CREATE INDEX `application_documents_applicationId_idx` ON `application_documents`(`applicationId`);
|
|
211
|
-
CREATE INDEX `application_documents_phaseId_idx` ON `application_documents`(`phaseId`);
|
|
212
|
-
CREATE INDEX `application_documents_stepId_idx` ON `application_documents`(`stepId`);
|
|
213
|
-
CREATE INDEX `application_documents_type_idx` ON `application_documents`(`type`);
|
|
214
|
-
CREATE INDEX `application_documents_status_idx` ON `application_documents`(`status`);
|
|
215
|
-
|
|
216
|
-
CREATE INDEX `application_refunds_applicationId_idx` ON `application_refunds`(`applicationId`);
|
|
217
|
-
CREATE INDEX `application_refunds_status_idx` ON `application_refunds`(`status`);
|
|
218
|
-
CREATE INDEX `application_refunds_tenantId_idx` ON `application_refunds`(`tenantId`);
|
|
219
|
-
CREATE INDEX `application_refunds_requestedById_idx` ON `application_refunds`(`requestedById`);
|
|
220
|
-
|
|
221
|
-
CREATE INDEX `application_terminations_applicationId_idx` ON `application_terminations`(`applicationId`);
|
|
222
|
-
CREATE INDEX `application_terminations_tenantId_idx` ON `application_terminations`(`tenantId`);
|
|
223
|
-
CREATE INDEX `application_terminations_status_idx` ON `application_terminations`(`status`);
|
|
224
|
-
CREATE INDEX `application_terminations_type_idx` ON `application_terminations`(`type`);
|
|
225
|
-
CREATE INDEX `application_terminations_initiatorId_idx` ON `application_terminations`(`initiatorId`);
|
|
226
|
-
CREATE INDEX `application_terminations_requestedAt_idx` ON `application_terminations`(`requestedAt`);
|
|
227
|
-
CREATE UNIQUE INDEX `application_terminations_requestNumber_key` ON `application_terminations`(`requestNumber`);
|
|
228
|
-
CREATE UNIQUE INDEX `application_terminations_idempotencyKey_key` ON `application_terminations`(`idempotencyKey`);
|
|
229
|
-
|
|
230
|
-
CREATE INDEX `payment_installments_paymentPhaseId_idx` ON `payment_installments`(`paymentPhaseId`);
|
|
231
|
-
CREATE INDEX `payment_installments_dueDate_idx` ON `payment_installments`(`dueDate`);
|
|
232
|
-
CREATE INDEX `payment_installments_status_idx` ON `payment_installments`(`status`);
|
|
233
|
-
|
|
234
|
-
CREATE INDEX `offer_letters_applicationId_idx` ON `offer_letters`(`applicationId`);
|
|
235
|
-
CREATE INDEX `payment_method_change_requests_applicationId_idx` ON `payment_method_change_requests`(`applicationId`);
|
|
236
|
-
CREATE INDEX `property_transfer_requests_sourceApplicationId_idx` ON `property_transfer_requests`(`sourceApplicationId`);
|
|
237
|
-
|
|
238
|
-
-- Step 10: Recreate foreign keys with new names
|
|
239
|
-
-- applications table
|
|
240
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
241
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_propertyUnitId_fkey` FOREIGN KEY (`propertyUnitId`) REFERENCES `property_units`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
242
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_buyerId_fkey` FOREIGN KEY (`buyerId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
243
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_sellerId_fkey` FOREIGN KEY (`sellerId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
244
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_paymentMethodId_fkey` FOREIGN KEY (`paymentMethodId`) REFERENCES `property_payment_methods`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
245
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_currentPhaseId_fkey` FOREIGN KEY (`currentPhaseId`) REFERENCES `application_phases`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
246
|
-
ALTER TABLE `applications` ADD CONSTRAINT `applications_transferredFromId_fkey` FOREIGN KEY (`transferredFromId`) REFERENCES `applications`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
247
|
-
|
|
248
|
-
-- application_phases
|
|
249
|
-
ALTER TABLE `application_phases` ADD CONSTRAINT `application_phases_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
250
|
-
|
|
251
|
-
-- questionnaire_phases, documentation_phases, payment_phases
|
|
252
|
-
ALTER TABLE `questionnaire_phases` ADD CONSTRAINT `questionnaire_phases_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `application_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
253
|
-
ALTER TABLE `documentation_phases` ADD CONSTRAINT `documentation_phases_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `application_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
254
|
-
ALTER TABLE `payment_phases` ADD CONSTRAINT `payment_phases_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `application_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
255
|
-
|
|
256
|
-
-- application_events
|
|
257
|
-
ALTER TABLE `application_events` ADD CONSTRAINT `application_events_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
258
|
-
|
|
259
|
-
-- payment_installments
|
|
260
|
-
ALTER TABLE `payment_installments` ADD CONSTRAINT `payment_installments_paymentPhaseId_fkey` FOREIGN KEY (`paymentPhaseId`) REFERENCES `payment_phases`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
261
|
-
|
|
262
|
-
-- application_payments
|
|
263
|
-
ALTER TABLE `application_payments` ADD CONSTRAINT `application_payments_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
264
|
-
ALTER TABLE `application_payments` ADD CONSTRAINT `application_payments_phaseId_fkey` FOREIGN KEY (`phaseId`) REFERENCES `application_phases`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
265
|
-
ALTER TABLE `application_payments` ADD CONSTRAINT `application_payments_installmentId_fkey` FOREIGN KEY (`installmentId`) REFERENCES `payment_installments`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
266
|
-
ALTER TABLE `application_payments` ADD CONSTRAINT `application_payments_payerId_fkey` FOREIGN KEY (`payerId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
267
|
-
|
|
268
|
-
-- application_documents
|
|
269
|
-
ALTER TABLE `application_documents` ADD CONSTRAINT `application_documents_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
270
|
-
ALTER TABLE `application_documents` ADD CONSTRAINT `application_documents_uploadedById_fkey` FOREIGN KEY (`uploadedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
271
|
-
|
|
272
|
-
-- application_refunds
|
|
273
|
-
ALTER TABLE `application_refunds` ADD CONSTRAINT `application_refunds_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
274
|
-
ALTER TABLE `application_refunds` ADD CONSTRAINT `application_refunds_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
275
|
-
ALTER TABLE `application_refunds` ADD CONSTRAINT `application_refunds_requestedById_fkey` FOREIGN KEY (`requestedById`) REFERENCES `users`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
276
|
-
ALTER TABLE `application_refunds` ADD CONSTRAINT `application_refunds_approvedById_fkey` FOREIGN KEY (`approvedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
277
|
-
ALTER TABLE `application_refunds` ADD CONSTRAINT `application_refunds_processedById_fkey` FOREIGN KEY (`processedById`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
278
|
-
|
|
279
|
-
-- application_terminations
|
|
280
|
-
ALTER TABLE `application_terminations` ADD CONSTRAINT `application_terminations_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
281
|
-
ALTER TABLE `application_terminations` ADD CONSTRAINT `application_terminations_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
282
|
-
ALTER TABLE `application_terminations` ADD CONSTRAINT `application_terminations_initiatorId_fkey` FOREIGN KEY (`initiatorId`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
283
|
-
ALTER TABLE `application_terminations` ADD CONSTRAINT `application_terminations_reviewedBy_fkey` FOREIGN KEY (`reviewedBy`) REFERENCES `users`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
284
|
-
|
|
285
|
-
-- offer_letters
|
|
286
|
-
ALTER TABLE `offer_letters` ADD CONSTRAINT `offer_letters_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
287
|
-
|
|
288
|
-
-- payment_method_change_requests
|
|
289
|
-
ALTER TABLE `payment_method_change_requests` ADD CONSTRAINT `payment_method_change_requests_applicationId_fkey` FOREIGN KEY (`applicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
290
|
-
|
|
291
|
-
-- property_transfer_requests
|
|
292
|
-
ALTER TABLE `property_transfer_requests` ADD CONSTRAINT `property_transfer_requests_sourceApplicationId_fkey` FOREIGN KEY (`sourceApplicationId`) REFERENCES `applications`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
293
|
-
ALTER TABLE `property_transfer_requests` ADD CONSTRAINT `property_transfer_requests_targetApplicationId_fkey` FOREIGN KEY (`targetApplicationId`) REFERENCES `applications`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
package/prisma/migrations/20260112081422_cleanup_rename_contract_to_application/migration.sql
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- You are about to drop the column `contractSnapshot` on the `application_terminations` table. All the data in the column will be lost.
|
|
5
|
-
- You are about to drop the column `totalContractAmount` on the `application_terminations` table. All the data in the column will be lost.
|
|
6
|
-
- Added the required column `applicationSnapshot` to the `application_terminations` table without a default value. This is not possible if the table is not empty.
|
|
7
|
-
- Added the required column `totalApplicationAmount` to the `application_terminations` table without a default value. This is not possible if the table is not empty.
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
-- AlterTable
|
|
11
|
-
ALTER TABLE `application_terminations` DROP COLUMN `contractSnapshot`,
|
|
12
|
-
DROP COLUMN `totalContractAmount`,
|
|
13
|
-
ADD COLUMN `applicationSnapshot` JSON NOT NULL,
|
|
14
|
-
ADD COLUMN `totalApplicationAmount` DOUBLE NOT NULL;
|
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Warnings:
|
|
3
|
-
|
|
4
|
-
- A unique constraint covering the columns `[tenantId,name]` on the table `amenities` will be added. If there are existing duplicate values, this will fail.
|
|
5
|
-
- Added the required column `tenantId` to the `amenities` table without a default value. This is not possible if the table is not empty.
|
|
6
|
-
- Added the required column `tenantId` to the `application_documents` table without a default value. This is not possible if the table is not empty.
|
|
7
|
-
- Added the required column `tenantId` to the `application_events` table without a default value. This is not possible if the table is not empty.
|
|
8
|
-
- Added the required column `tenantId` to the `application_payments` table without a default value. This is not possible if the table is not empty.
|
|
9
|
-
- Added the required column `tenantId` to the `application_phases` table without a default value. This is not possible if the table is not empty.
|
|
10
|
-
- Added the required column `tenantId` to the `documentation_phases` table without a default value. This is not possible if the table is not empty.
|
|
11
|
-
- Added the required column `tenantId` to the `documentation_step_approvals` table without a default value. This is not possible if the table is not empty.
|
|
12
|
-
- Added the required column `tenantId` to the `documentation_step_documents` table without a default value. This is not possible if the table is not empty.
|
|
13
|
-
- Added the required column `tenantId` to the `documentation_steps` table without a default value. This is not possible if the table is not empty.
|
|
14
|
-
- Added the required column `tenantId` to the `event_handler_executions` table without a default value. This is not possible if the table is not empty.
|
|
15
|
-
- Added the required column `tenantId` to the `payment_installments` table without a default value. This is not possible if the table is not empty.
|
|
16
|
-
- Added the required column `tenantId` to the `payment_method_phase_documents` table without a default value. This is not possible if the table is not empty.
|
|
17
|
-
- Added the required column `tenantId` to the `payment_method_phase_fields` table without a default value. This is not possible if the table is not empty.
|
|
18
|
-
- Added the required column `tenantId` to the `payment_method_phase_steps` table without a default value. This is not possible if the table is not empty.
|
|
19
|
-
- Added the required column `tenantId` to the `payment_phases` table without a default value. This is not possible if the table is not empty.
|
|
20
|
-
- Added the required column `tenantId` to the `phase_event_attachments` table without a default value. This is not possible if the table is not empty.
|
|
21
|
-
- Added the required column `tenantId` to the `property_amenities` table without a default value. This is not possible if the table is not empty.
|
|
22
|
-
- Added the required column `tenantId` to the `property_documents` table without a default value. This is not possible if the table is not empty.
|
|
23
|
-
- Added the required column `tenantId` to the `property_media` table without a default value. This is not possible if the table is not empty.
|
|
24
|
-
- Added the required column `tenantId` to the `property_payment_method_links` table without a default value. This is not possible if the table is not empty.
|
|
25
|
-
- Added the required column `tenantId` to the `property_payment_method_phases` table without a default value. This is not possible if the table is not empty.
|
|
26
|
-
- Added the required column `tenantId` to the `property_units` table without a default value. This is not possible if the table is not empty.
|
|
27
|
-
- Added the required column `tenantId` to the `property_variant_amenities` table without a default value. This is not possible if the table is not empty.
|
|
28
|
-
- Added the required column `tenantId` to the `property_variant_media` table without a default value. This is not possible if the table is not empty.
|
|
29
|
-
- Added the required column `tenantId` to the `property_variants` table without a default value. This is not possible if the table is not empty.
|
|
30
|
-
- Added the required column `tenantId` to the `questionnaire_fields` table without a default value. This is not possible if the table is not empty.
|
|
31
|
-
- Added the required column `tenantId` to the `questionnaire_phases` table without a default value. This is not possible if the table is not empty.
|
|
32
|
-
- Added the required column `tenantId` to the `step_event_attachments` table without a default value. This is not possible if the table is not empty.
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
-- DropIndex
|
|
36
|
-
DROP INDEX `amenities_name_key` ON `amenities`;
|
|
37
|
-
|
|
38
|
-
-- AlterTable
|
|
39
|
-
ALTER TABLE `amenities` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
40
|
-
|
|
41
|
-
-- AlterTable
|
|
42
|
-
ALTER TABLE `application_documents` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
43
|
-
|
|
44
|
-
-- AlterTable
|
|
45
|
-
ALTER TABLE `application_events` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
46
|
-
|
|
47
|
-
-- AlterTable
|
|
48
|
-
ALTER TABLE `application_payments` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
49
|
-
|
|
50
|
-
-- AlterTable
|
|
51
|
-
ALTER TABLE `application_phases` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
52
|
-
|
|
53
|
-
-- AlterTable
|
|
54
|
-
ALTER TABLE `documentation_phases` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
55
|
-
|
|
56
|
-
-- AlterTable
|
|
57
|
-
ALTER TABLE `documentation_step_approvals` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
58
|
-
|
|
59
|
-
-- AlterTable
|
|
60
|
-
ALTER TABLE `documentation_step_documents` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
61
|
-
|
|
62
|
-
-- AlterTable
|
|
63
|
-
ALTER TABLE `documentation_steps` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
64
|
-
|
|
65
|
-
-- AlterTable
|
|
66
|
-
ALTER TABLE `event_handler_executions` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
67
|
-
|
|
68
|
-
-- AlterTable
|
|
69
|
-
ALTER TABLE `payment_installments` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
70
|
-
|
|
71
|
-
-- AlterTable
|
|
72
|
-
ALTER TABLE `payment_method_phase_documents` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
73
|
-
|
|
74
|
-
-- AlterTable
|
|
75
|
-
ALTER TABLE `payment_method_phase_fields` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
76
|
-
|
|
77
|
-
-- AlterTable
|
|
78
|
-
ALTER TABLE `payment_method_phase_steps` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
79
|
-
|
|
80
|
-
-- AlterTable
|
|
81
|
-
ALTER TABLE `payment_phases` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
82
|
-
|
|
83
|
-
-- AlterTable
|
|
84
|
-
ALTER TABLE `phase_event_attachments` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
85
|
-
|
|
86
|
-
-- AlterTable
|
|
87
|
-
ALTER TABLE `property_amenities` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
88
|
-
|
|
89
|
-
-- AlterTable
|
|
90
|
-
ALTER TABLE `property_documents` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
91
|
-
|
|
92
|
-
-- AlterTable
|
|
93
|
-
ALTER TABLE `property_media` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
94
|
-
|
|
95
|
-
-- AlterTable
|
|
96
|
-
ALTER TABLE `property_payment_method_links` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
97
|
-
|
|
98
|
-
-- AlterTable
|
|
99
|
-
ALTER TABLE `property_payment_method_phases` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
100
|
-
|
|
101
|
-
-- AlterTable
|
|
102
|
-
ALTER TABLE `property_units` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
103
|
-
|
|
104
|
-
-- AlterTable
|
|
105
|
-
ALTER TABLE `property_variant_amenities` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
106
|
-
|
|
107
|
-
-- AlterTable
|
|
108
|
-
ALTER TABLE `property_variant_media` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
109
|
-
|
|
110
|
-
-- AlterTable
|
|
111
|
-
ALTER TABLE `property_variants` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
112
|
-
|
|
113
|
-
-- AlterTable
|
|
114
|
-
ALTER TABLE `questionnaire_fields` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
115
|
-
|
|
116
|
-
-- AlterTable
|
|
117
|
-
ALTER TABLE `questionnaire_phases` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
118
|
-
|
|
119
|
-
-- AlterTable
|
|
120
|
-
ALTER TABLE `step_event_attachments` ADD COLUMN `tenantId` VARCHAR(191) NOT NULL;
|
|
121
|
-
|
|
122
|
-
-- CreateTable
|
|
123
|
-
CREATE TABLE `workflow_blockers` (
|
|
124
|
-
`id` VARCHAR(191) NOT NULL,
|
|
125
|
-
`tenantId` VARCHAR(191) NOT NULL,
|
|
126
|
-
`applicationId` VARCHAR(191) NOT NULL,
|
|
127
|
-
`phaseId` VARCHAR(191) NULL,
|
|
128
|
-
`stepId` VARCHAR(191) NULL,
|
|
129
|
-
`blockerActor` ENUM('CUSTOMER', 'ADMIN', 'SYSTEM', 'EXTERNAL') NOT NULL,
|
|
130
|
-
`blockerCategory` ENUM('UPLOAD', 'RESUBMISSION', 'SIGNATURE', 'REVIEW', 'APPROVAL', 'PAYMENT', 'PROCESSING', 'EXTERNAL_CHECK', 'QUESTIONNAIRE') NOT NULL,
|
|
131
|
-
`urgency` ENUM('LOW', 'NORMAL', 'HIGH', 'CRITICAL') NOT NULL DEFAULT 'NORMAL',
|
|
132
|
-
`actionRequired` VARCHAR(500) NOT NULL,
|
|
133
|
-
`context` TEXT NULL,
|
|
134
|
-
`expectedByDate` DATETIME(3) NULL,
|
|
135
|
-
`isOverdue` BOOLEAN NOT NULL DEFAULT false,
|
|
136
|
-
`overdueAt` DATETIME(3) NULL,
|
|
137
|
-
`startedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
138
|
-
`resolvedAt` DATETIME(3) NULL,
|
|
139
|
-
`durationMs` INTEGER NULL,
|
|
140
|
-
`resolvedByActor` VARCHAR(191) NULL,
|
|
141
|
-
`resolutionTrigger` VARCHAR(191) NULL,
|
|
142
|
-
`reminderCount` INTEGER NOT NULL DEFAULT 0,
|
|
143
|
-
`lastReminderAt` DATETIME(3) NULL,
|
|
144
|
-
`nextReminderAt` DATETIME(3) NULL,
|
|
145
|
-
`metadata` JSON NULL,
|
|
146
|
-
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
147
|
-
`updatedAt` DATETIME(3) NOT NULL,
|
|
148
|
-
|
|
149
|
-
INDEX `workflow_blockers_tenantId_idx`(`tenantId`),
|
|
150
|
-
INDEX `workflow_blockers_applicationId_idx`(`applicationId`),
|
|
151
|
-
INDEX `workflow_blockers_phaseId_idx`(`phaseId`),
|
|
152
|
-
INDEX `workflow_blockers_stepId_idx`(`stepId`),
|
|
153
|
-
INDEX `workflow_blockers_blockerActor_idx`(`blockerActor`),
|
|
154
|
-
INDEX `workflow_blockers_blockerCategory_idx`(`blockerCategory`),
|
|
155
|
-
INDEX `workflow_blockers_urgency_idx`(`urgency`),
|
|
156
|
-
INDEX `workflow_blockers_isOverdue_idx`(`isOverdue`),
|
|
157
|
-
INDEX `workflow_blockers_startedAt_idx`(`startedAt`),
|
|
158
|
-
INDEX `workflow_blockers_resolvedAt_idx`(`resolvedAt`),
|
|
159
|
-
INDEX `workflow_blockers_tenantId_blockerActor_resolvedAt_idx`(`tenantId`, `blockerActor`, `resolvedAt`),
|
|
160
|
-
INDEX `workflow_blockers_tenantId_blockerCategory_resolvedAt_idx`(`tenantId`, `blockerCategory`, `resolvedAt`),
|
|
161
|
-
INDEX `workflow_blockers_tenantId_isOverdue_blockerActor_idx`(`tenantId`, `isOverdue`, `blockerActor`),
|
|
162
|
-
PRIMARY KEY (`id`)
|
|
163
|
-
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
164
|
-
|
|
165
|
-
-- CreateIndex
|
|
166
|
-
CREATE INDEX `amenities_tenantId_idx` ON `amenities`(`tenantId`);
|
|
167
|
-
|
|
168
|
-
-- CreateIndex
|
|
169
|
-
CREATE UNIQUE INDEX `amenities_tenantId_name_key` ON `amenities`(`tenantId`, `name`);
|
|
170
|
-
|
|
171
|
-
-- CreateIndex
|
|
172
|
-
CREATE INDEX `application_documents_tenantId_idx` ON `application_documents`(`tenantId`);
|
|
173
|
-
|
|
174
|
-
-- CreateIndex
|
|
175
|
-
CREATE INDEX `application_events_tenantId_idx` ON `application_events`(`tenantId`);
|
|
176
|
-
|
|
177
|
-
-- CreateIndex
|
|
178
|
-
CREATE INDEX `application_payments_tenantId_idx` ON `application_payments`(`tenantId`);
|
|
179
|
-
|
|
180
|
-
-- CreateIndex
|
|
181
|
-
CREATE INDEX `application_phases_tenantId_idx` ON `application_phases`(`tenantId`);
|
|
182
|
-
|
|
183
|
-
-- CreateIndex
|
|
184
|
-
CREATE INDEX `documentation_phases_tenantId_idx` ON `documentation_phases`(`tenantId`);
|
|
185
|
-
|
|
186
|
-
-- CreateIndex
|
|
187
|
-
CREATE INDEX `documentation_step_approvals_tenantId_idx` ON `documentation_step_approvals`(`tenantId`);
|
|
188
|
-
|
|
189
|
-
-- CreateIndex
|
|
190
|
-
CREATE INDEX `documentation_step_documents_tenantId_idx` ON `documentation_step_documents`(`tenantId`);
|
|
191
|
-
|
|
192
|
-
-- CreateIndex
|
|
193
|
-
CREATE INDEX `documentation_steps_tenantId_idx` ON `documentation_steps`(`tenantId`);
|
|
194
|
-
|
|
195
|
-
-- CreateIndex
|
|
196
|
-
CREATE INDEX `event_handler_executions_tenantId_idx` ON `event_handler_executions`(`tenantId`);
|
|
197
|
-
|
|
198
|
-
-- CreateIndex
|
|
199
|
-
CREATE INDEX `payment_installments_tenantId_idx` ON `payment_installments`(`tenantId`);
|
|
200
|
-
|
|
201
|
-
-- CreateIndex
|
|
202
|
-
CREATE INDEX `payment_method_phase_documents_tenantId_idx` ON `payment_method_phase_documents`(`tenantId`);
|
|
203
|
-
|
|
204
|
-
-- CreateIndex
|
|
205
|
-
CREATE INDEX `payment_method_phase_fields_tenantId_idx` ON `payment_method_phase_fields`(`tenantId`);
|
|
206
|
-
|
|
207
|
-
-- CreateIndex
|
|
208
|
-
CREATE INDEX `payment_method_phase_steps_tenantId_idx` ON `payment_method_phase_steps`(`tenantId`);
|
|
209
|
-
|
|
210
|
-
-- CreateIndex
|
|
211
|
-
CREATE INDEX `payment_phases_tenantId_idx` ON `payment_phases`(`tenantId`);
|
|
212
|
-
|
|
213
|
-
-- CreateIndex
|
|
214
|
-
CREATE INDEX `phase_event_attachments_tenantId_idx` ON `phase_event_attachments`(`tenantId`);
|
|
215
|
-
|
|
216
|
-
-- CreateIndex
|
|
217
|
-
CREATE INDEX `property_amenities_tenantId_idx` ON `property_amenities`(`tenantId`);
|
|
218
|
-
|
|
219
|
-
-- CreateIndex
|
|
220
|
-
CREATE INDEX `property_documents_tenantId_idx` ON `property_documents`(`tenantId`);
|
|
221
|
-
|
|
222
|
-
-- CreateIndex
|
|
223
|
-
CREATE INDEX `property_media_tenantId_idx` ON `property_media`(`tenantId`);
|
|
224
|
-
|
|
225
|
-
-- CreateIndex
|
|
226
|
-
CREATE INDEX `property_payment_method_links_tenantId_idx` ON `property_payment_method_links`(`tenantId`);
|
|
227
|
-
|
|
228
|
-
-- CreateIndex
|
|
229
|
-
CREATE INDEX `property_payment_method_phases_tenantId_idx` ON `property_payment_method_phases`(`tenantId`);
|
|
230
|
-
|
|
231
|
-
-- CreateIndex
|
|
232
|
-
CREATE INDEX `property_units_tenantId_idx` ON `property_units`(`tenantId`);
|
|
233
|
-
|
|
234
|
-
-- CreateIndex
|
|
235
|
-
CREATE INDEX `property_variant_amenities_tenantId_idx` ON `property_variant_amenities`(`tenantId`);
|
|
236
|
-
|
|
237
|
-
-- CreateIndex
|
|
238
|
-
CREATE INDEX `property_variant_media_tenantId_idx` ON `property_variant_media`(`tenantId`);
|
|
239
|
-
|
|
240
|
-
-- CreateIndex
|
|
241
|
-
CREATE INDEX `property_variants_tenantId_idx` ON `property_variants`(`tenantId`);
|
|
242
|
-
|
|
243
|
-
-- CreateIndex
|
|
244
|
-
CREATE INDEX `questionnaire_fields_tenantId_idx` ON `questionnaire_fields`(`tenantId`);
|
|
245
|
-
|
|
246
|
-
-- CreateIndex
|
|
247
|
-
CREATE INDEX `questionnaire_phases_tenantId_idx` ON `questionnaire_phases`(`tenantId`);
|
|
248
|
-
|
|
249
|
-
-- CreateIndex
|
|
250
|
-
CREATE INDEX `step_event_attachments_tenantId_idx` ON `step_event_attachments`(`tenantId`);
|
|
251
|
-
|
|
252
|
-
-- AddForeignKey
|
|
253
|
-
ALTER TABLE `property_media` ADD CONSTRAINT `property_media_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
254
|
-
|
|
255
|
-
-- AddForeignKey
|
|
256
|
-
ALTER TABLE `property_documents` ADD CONSTRAINT `property_documents_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
257
|
-
|
|
258
|
-
-- AddForeignKey
|
|
259
|
-
ALTER TABLE `amenities` ADD CONSTRAINT `amenities_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
260
|
-
|
|
261
|
-
-- AddForeignKey
|
|
262
|
-
ALTER TABLE `property_variants` ADD CONSTRAINT `property_variants_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
263
|
-
|
|
264
|
-
-- AddForeignKey
|
|
265
|
-
ALTER TABLE `property_variant_amenities` ADD CONSTRAINT `property_variant_amenities_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
266
|
-
|
|
267
|
-
-- AddForeignKey
|
|
268
|
-
ALTER TABLE `property_variant_media` ADD CONSTRAINT `property_variant_media_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
269
|
-
|
|
270
|
-
-- AddForeignKey
|
|
271
|
-
ALTER TABLE `property_units` ADD CONSTRAINT `property_units_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
272
|
-
|
|
273
|
-
-- AddForeignKey
|
|
274
|
-
ALTER TABLE `property_amenities` ADD CONSTRAINT `property_amenities_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
275
|
-
|
|
276
|
-
-- AddForeignKey
|
|
277
|
-
ALTER TABLE `property_payment_method_links` ADD CONSTRAINT `property_payment_method_links_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
278
|
-
|
|
279
|
-
-- AddForeignKey
|
|
280
|
-
ALTER TABLE `property_payment_method_phases` ADD CONSTRAINT `property_payment_method_phases_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
281
|
-
|
|
282
|
-
-- AddForeignKey
|
|
283
|
-
ALTER TABLE `phase_event_attachments` ADD CONSTRAINT `phase_event_attachments_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
284
|
-
|
|
285
|
-
-- AddForeignKey
|
|
286
|
-
ALTER TABLE `payment_method_phase_steps` ADD CONSTRAINT `payment_method_phase_steps_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
287
|
-
|
|
288
|
-
-- AddForeignKey
|
|
289
|
-
ALTER TABLE `step_event_attachments` ADD CONSTRAINT `step_event_attachments_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
290
|
-
|
|
291
|
-
-- AddForeignKey
|
|
292
|
-
ALTER TABLE `payment_method_phase_documents` ADD CONSTRAINT `payment_method_phase_documents_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
293
|
-
|
|
294
|
-
-- AddForeignKey
|
|
295
|
-
ALTER TABLE `payment_method_phase_fields` ADD CONSTRAINT `payment_method_phase_fields_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
296
|
-
|
|
297
|
-
-- AddForeignKey
|
|
298
|
-
ALTER TABLE `application_phases` ADD CONSTRAINT `application_phases_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
299
|
-
|
|
300
|
-
-- AddForeignKey
|
|
301
|
-
ALTER TABLE `questionnaire_phases` ADD CONSTRAINT `questionnaire_phases_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
302
|
-
|
|
303
|
-
-- AddForeignKey
|
|
304
|
-
ALTER TABLE `documentation_phases` ADD CONSTRAINT `documentation_phases_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
305
|
-
|
|
306
|
-
-- AddForeignKey
|
|
307
|
-
ALTER TABLE `payment_phases` ADD CONSTRAINT `payment_phases_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
308
|
-
|
|
309
|
-
-- AddForeignKey
|
|
310
|
-
ALTER TABLE `questionnaire_fields` ADD CONSTRAINT `questionnaire_fields_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
311
|
-
|
|
312
|
-
-- AddForeignKey
|
|
313
|
-
ALTER TABLE `application_events` ADD CONSTRAINT `application_events_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
314
|
-
|
|
315
|
-
-- AddForeignKey
|
|
316
|
-
ALTER TABLE `documentation_steps` ADD CONSTRAINT `documentation_steps_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
317
|
-
|
|
318
|
-
-- AddForeignKey
|
|
319
|
-
ALTER TABLE `documentation_step_documents` ADD CONSTRAINT `documentation_step_documents_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
320
|
-
|
|
321
|
-
-- AddForeignKey
|
|
322
|
-
ALTER TABLE `documentation_step_approvals` ADD CONSTRAINT `documentation_step_approvals_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
323
|
-
|
|
324
|
-
-- AddForeignKey
|
|
325
|
-
ALTER TABLE `payment_installments` ADD CONSTRAINT `payment_installments_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
326
|
-
|
|
327
|
-
-- AddForeignKey
|
|
328
|
-
ALTER TABLE `application_payments` ADD CONSTRAINT `application_payments_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
329
|
-
|
|
330
|
-
-- AddForeignKey
|
|
331
|
-
ALTER TABLE `application_documents` ADD CONSTRAINT `application_documents_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
332
|
-
|
|
333
|
-
-- AddForeignKey
|
|
334
|
-
ALTER TABLE `event_handler_executions` ADD CONSTRAINT `event_handler_executions_tenantId_fkey` FOREIGN KEY (`tenantId`) REFERENCES `tenants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|