@valentine-efagene/qshelter-common 2.0.99 → 2.0.100
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/internal/class.js +2 -2
- package/dist/generated/client/internal/prismaNamespace.d.ts +56 -0
- package/dist/generated/client/internal/prismaNamespace.js +56 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.d.ts +56 -0
- package/dist/generated/client/internal/prismaNamespaceBrowser.js +56 -0
- package/dist/generated/client/models/Amenity.d.ts +183 -3
- package/dist/generated/client/models/ApplicationDocument.d.ts +183 -1
- package/dist/generated/client/models/ApplicationEvent.d.ts +190 -14
- package/dist/generated/client/models/ApplicationPayment.d.ts +225 -1
- package/dist/generated/client/models/ApplicationPhase.d.ts +272 -26
- package/dist/generated/client/models/DocumentationPhase.d.ts +224 -24
- package/dist/generated/client/models/DocumentationStep.d.ts +237 -1
- package/dist/generated/client/models/DocumentationStepApproval.d.ts +159 -1
- package/dist/generated/client/models/DocumentationStepDocument.d.ts +150 -10
- package/dist/generated/client/models/EventHandlerExecution.d.ts +208 -14
- package/dist/generated/client/models/PaymentInstallment.d.ts +228 -14
- package/dist/generated/client/models/PaymentMethodPhaseDocument.d.ts +178 -14
- package/dist/generated/client/models/PaymentMethodPhaseField.d.ts +208 -14
- package/dist/generated/client/models/PaymentMethodPhaseStep.d.ts +180 -14
- package/dist/generated/client/models/PaymentPhase.d.ts +214 -14
- package/dist/generated/client/models/PhaseEventAttachment.d.ts +178 -14
- package/dist/generated/client/models/PropertyAmenity.d.ts +145 -11
- package/dist/generated/client/models/PropertyDocument.d.ts +164 -12
- package/dist/generated/client/models/PropertyMedia.d.ts +183 -17
- package/dist/generated/client/models/PropertyPaymentMethodLink.d.ts +159 -13
- package/dist/generated/client/models/PropertyPaymentMethodPhase.d.ts +270 -14
- package/dist/generated/client/models/PropertyUnit.d.ts +230 -14
- package/dist/generated/client/models/PropertyVariant.d.ts +256 -14
- package/dist/generated/client/models/PropertyVariantAmenity.d.ts +145 -11
- package/dist/generated/client/models/PropertyVariantMedia.d.ts +171 -13
- package/dist/generated/client/models/QuestionnaireField.d.ts +232 -14
- package/dist/generated/client/models/QuestionnairePhase.d.ts +207 -1
- package/dist/generated/client/models/StepEventAttachment.d.ts +178 -14
- package/dist/generated/client/models/Tenant.d.ts +11653 -1153
- package/dist/src/prisma/tenant.js +26 -32
- package/package.json +1 -1
- package/prisma/migrations/20260113000000_remove_workflow_analytics_summary/migration.sql +5 -0
- package/prisma/migrations/20260113110450_add_tenant_id_to_child_models/migration.sql +334 -0
- package/prisma/schema.prisma +143 -30
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* INVERTED APPROACH:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* This reduces the risk of accidentally omitting a new model from tenant scoping.
|
|
2
|
+
* INVERTED APPROACH: List models that DON'T have a tenantId field.
|
|
3
|
+
* All other models are assumed to be tenant-scoped.
|
|
4
|
+
* This is easier to manage since most models ARE tenant-scoped.
|
|
6
5
|
*/
|
|
7
6
|
/**
|
|
8
|
-
* Models that are
|
|
9
|
-
* These
|
|
10
|
-
* - Don't have a tenantId field (system tables)
|
|
11
|
-
* - Have optional tenantId but are designed to work across tenants (User)
|
|
12
|
-
* - Are cross-tenant lookup/join tables (TenantMembership)
|
|
7
|
+
* Models that are truly global and have NO tenantId field at all.
|
|
8
|
+
* These are excluded from tenant filtering/injection.
|
|
13
9
|
*/
|
|
14
10
|
const GLOBAL_MODELS = [
|
|
15
|
-
//
|
|
11
|
+
// System-level entities with no tenant ownership
|
|
12
|
+
"tenant",
|
|
16
13
|
"user",
|
|
17
|
-
// TenantMembership is the user-tenant join table (queries by userId or tenantId)
|
|
18
14
|
"tenantMembership",
|
|
19
|
-
// System/infrastructure tables without tenantId
|
|
20
|
-
"tenant",
|
|
21
|
-
// Legacy role assignment (global, not tenant-scoped)
|
|
22
|
-
"userRole",
|
|
23
|
-
"rolePermission",
|
|
24
|
-
"refreshToken",
|
|
25
|
-
"passwordReset",
|
|
26
|
-
"wallet",
|
|
27
|
-
"domainEvent",
|
|
28
15
|
];
|
|
29
16
|
/**
|
|
30
17
|
* Models that have OPTIONAL tenant scoping (nullable tenantId).
|
|
@@ -45,9 +32,16 @@ function isOptionalTenantModel(model) {
|
|
|
45
32
|
return OPTIONAL_TENANT_MODELS.includes(model);
|
|
46
33
|
}
|
|
47
34
|
/**
|
|
48
|
-
*
|
|
35
|
+
* Check if model is tenant-scoped (required tenantId)
|
|
36
|
+
* A model is tenant-scoped if it's NOT global and NOT optional-tenant
|
|
49
37
|
*/
|
|
50
38
|
function isTenantScopedModel(model) {
|
|
39
|
+
return !isGlobalModel(model) && !isOptionalTenantModel(model);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if model has any tenant scoping (required or optional)
|
|
43
|
+
*/
|
|
44
|
+
function hasTenantField(model) {
|
|
51
45
|
return !isGlobalModel(model);
|
|
52
46
|
}
|
|
53
47
|
/**
|
|
@@ -68,7 +62,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
68
62
|
query: {
|
|
69
63
|
$allModels: {
|
|
70
64
|
async findMany({ model, args, query }) {
|
|
71
|
-
if (
|
|
65
|
+
if (hasTenantField(model)) {
|
|
72
66
|
const tenantFilter = isOptionalTenantModel(model)
|
|
73
67
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
74
68
|
: { tenantId };
|
|
@@ -80,7 +74,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
80
74
|
return query(args);
|
|
81
75
|
},
|
|
82
76
|
async findFirst({ model, args, query }) {
|
|
83
|
-
if (
|
|
77
|
+
if (hasTenantField(model)) {
|
|
84
78
|
const tenantFilter = isOptionalTenantModel(model)
|
|
85
79
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
86
80
|
: { tenantId };
|
|
@@ -94,7 +88,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
94
88
|
async findUnique({ model, args, query }) {
|
|
95
89
|
// findUnique can only filter by unique fields, so we verify after fetch
|
|
96
90
|
const result = await query(args);
|
|
97
|
-
if (result &&
|
|
91
|
+
if (result && hasTenantField(model)) {
|
|
98
92
|
const record = result;
|
|
99
93
|
if (isOptionalTenantModel(model)) {
|
|
100
94
|
// Allow null tenantId (global) or matching tenantId
|
|
@@ -111,7 +105,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
111
105
|
return result;
|
|
112
106
|
},
|
|
113
107
|
async create({ model, args, query }) {
|
|
114
|
-
if (isTenantScopedModel(model)
|
|
108
|
+
if (isTenantScopedModel(model)) {
|
|
115
109
|
// Inject tenantId for required tenant models
|
|
116
110
|
args.data.tenantId = tenantId;
|
|
117
111
|
}
|
|
@@ -124,10 +118,10 @@ export function createTenantPrisma(prisma, context) {
|
|
|
124
118
|
return query(args);
|
|
125
119
|
},
|
|
126
120
|
async createMany({ model, args, query }) {
|
|
127
|
-
if (
|
|
121
|
+
if (hasTenantField(model)) {
|
|
128
122
|
const data = Array.isArray(args.data) ? args.data : [args.data];
|
|
129
123
|
args.data = data.map((item) => {
|
|
130
|
-
if (
|
|
124
|
+
if (isTenantScopedModel(model)) {
|
|
131
125
|
return { ...item, tenantId };
|
|
132
126
|
}
|
|
133
127
|
// For optional models, inject if not explicitly set
|
|
@@ -140,7 +134,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
140
134
|
return query(args);
|
|
141
135
|
},
|
|
142
136
|
async update({ model, args, query }) {
|
|
143
|
-
if (
|
|
137
|
+
if (hasTenantField(model)) {
|
|
144
138
|
// Verify tenant ownership before update
|
|
145
139
|
const tenantFilter = isOptionalTenantModel(model)
|
|
146
140
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
@@ -153,7 +147,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
153
147
|
return query(args);
|
|
154
148
|
},
|
|
155
149
|
async updateMany({ model, args, query }) {
|
|
156
|
-
if (
|
|
150
|
+
if (hasTenantField(model)) {
|
|
157
151
|
const tenantFilter = isOptionalTenantModel(model)
|
|
158
152
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
159
153
|
: { tenantId };
|
|
@@ -165,7 +159,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
165
159
|
return query(args);
|
|
166
160
|
},
|
|
167
161
|
async delete({ model, args, query }) {
|
|
168
|
-
if (
|
|
162
|
+
if (hasTenantField(model)) {
|
|
169
163
|
const tenantFilter = isOptionalTenantModel(model)
|
|
170
164
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
171
165
|
: { tenantId };
|
|
@@ -177,7 +171,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
177
171
|
return query(args);
|
|
178
172
|
},
|
|
179
173
|
async deleteMany({ model, args, query }) {
|
|
180
|
-
if (
|
|
174
|
+
if (hasTenantField(model)) {
|
|
181
175
|
const tenantFilter = isOptionalTenantModel(model)
|
|
182
176
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
183
177
|
: { tenantId };
|
|
@@ -189,7 +183,7 @@ export function createTenantPrisma(prisma, context) {
|
|
|
189
183
|
return query(args);
|
|
190
184
|
},
|
|
191
185
|
async count({ model, args, query }) {
|
|
192
|
-
if (
|
|
186
|
+
if (hasTenantField(model)) {
|
|
193
187
|
const tenantFilter = isOptionalTenantModel(model)
|
|
194
188
|
? { OR: [{ tenantId }, { tenantId: null }] }
|
|
195
189
|
: { tenantId };
|
package/package.json
CHANGED
|
@@ -0,0 +1,334 @@
|
|
|
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;
|