@tstdl/base 0.93.78 → 0.93.80

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.
@@ -8,7 +8,7 @@ CREATE TYPE "document_management"."workflow_fail_reason" AS ENUM('no-suitable-co
8
8
  CREATE TYPE "document_management"."workflow_state" AS ENUM('pending', 'running', 'review', 'completed', 'error', 'failed');--> statement-breakpoint
9
9
  CREATE TYPE "document_management"."workflow_step" AS ENUM('classification', 'extraction', 'assignment', 'validation');--> statement-breakpoint
10
10
  CREATE TABLE "document_management"."document" (
11
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
11
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
12
12
  "tenant_id" uuid NOT NULL,
13
13
  "type_id" uuid,
14
14
  "title" text,
@@ -22,17 +22,17 @@ CREATE TABLE "document_management"."document" (
22
22
  "mime_type" text NOT NULL,
23
23
  "hash" text NOT NULL,
24
24
  "size" integer NOT NULL,
25
- "create_user_id" uuid,
26
25
  "revision" integer NOT NULL,
27
26
  "revision_timestamp" timestamp with time zone NOT NULL,
28
27
  "create_timestamp" timestamp with time zone NOT NULL,
29
28
  "delete_timestamp" timestamp with time zone,
30
29
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
30
+ CONSTRAINT "document_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
31
31
  CONSTRAINT "document_tenant_id_id_unique" UNIQUE("tenant_id","id")
32
32
  );
33
33
  --> statement-breakpoint
34
34
  CREATE TABLE "document_management"."assignment_scope" (
35
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
35
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
36
36
  "tenant_id" uuid NOT NULL,
37
37
  "task_id" uuid NOT NULL,
38
38
  "collection_id" uuid NOT NULL,
@@ -41,11 +41,12 @@ CREATE TABLE "document_management"."assignment_scope" (
41
41
  "create_timestamp" timestamp with time zone NOT NULL,
42
42
  "delete_timestamp" timestamp with time zone,
43
43
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
44
+ CONSTRAINT "assignment_scope_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
44
45
  CONSTRAINT "assignment_scope_task_id_collection_id_unique" UNIQUE("task_id","collection_id")
45
46
  );
46
47
  --> statement-breakpoint
47
48
  CREATE TABLE "document_management"."assignment_task" (
48
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
49
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
49
50
  "tenant_id" uuid NOT NULL,
50
51
  "document_id" uuid NOT NULL,
51
52
  "target" "document_management"."assignment_target" NOT NULL,
@@ -54,13 +55,14 @@ CREATE TABLE "document_management"."assignment_task" (
54
55
  "create_timestamp" timestamp with time zone NOT NULL,
55
56
  "delete_timestamp" timestamp with time zone,
56
57
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
58
+ CONSTRAINT "assignment_task_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
57
59
  CONSTRAINT "assignment_task_document_id_unique" UNIQUE("document_id"),
58
60
  CONSTRAINT "assignment_task_tenant_id_id_unique" UNIQUE("tenant_id","id")
59
61
  );
60
62
  --> statement-breakpoint
61
63
  CREATE TABLE "document_management"."category" (
62
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
63
- "tenant_id" uuid,
64
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
65
+ "tenant_id" uuid NOT NULL,
64
66
  "parent_id" uuid,
65
67
  "label" text NOT NULL,
66
68
  "revision" integer NOT NULL,
@@ -68,12 +70,13 @@ CREATE TABLE "document_management"."category" (
68
70
  "create_timestamp" timestamp with time zone NOT NULL,
69
71
  "delete_timestamp" timestamp with time zone,
70
72
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
73
+ CONSTRAINT "category_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
71
74
  CONSTRAINT "category_label_unique" UNIQUE("label"),
72
75
  CONSTRAINT "category_tenant_id_parent_id_label_unique" UNIQUE("tenant_id","parent_id","label")
73
76
  );
74
77
  --> statement-breakpoint
75
78
  CREATE TABLE "document_management"."collection" (
76
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
79
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
77
80
  "tenant_id" uuid NOT NULL,
78
81
  "parent_id" uuid,
79
82
  "revision" integer NOT NULL,
@@ -81,11 +84,12 @@ CREATE TABLE "document_management"."collection" (
81
84
  "create_timestamp" timestamp with time zone NOT NULL,
82
85
  "delete_timestamp" timestamp with time zone,
83
86
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
87
+ CONSTRAINT "collection_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
84
88
  CONSTRAINT "collection_tenant_id_id_unique" UNIQUE("tenant_id","id")
85
89
  );
86
90
  --> statement-breakpoint
87
91
  CREATE TABLE "document_management"."collection_assignment" (
88
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
92
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
89
93
  "tenant_id" uuid NOT NULL,
90
94
  "collection_id" uuid NOT NULL,
91
95
  "document_id" uuid NOT NULL,
@@ -95,12 +99,13 @@ CREATE TABLE "document_management"."collection_assignment" (
95
99
  "create_timestamp" timestamp with time zone NOT NULL,
96
100
  "delete_timestamp" timestamp with time zone,
97
101
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
102
+ CONSTRAINT "collection_assignment_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
98
103
  CONSTRAINT "ca_tenant_id_collection_id_document_id_unique" UNIQUE("tenant_id","collection_id","document_id")
99
104
  );
100
105
  --> statement-breakpoint
101
106
  CREATE TABLE "document_management"."property" (
102
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
103
- "tenant_id" uuid,
107
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
108
+ "tenant_id" uuid NOT NULL,
104
109
  "label" text NOT NULL,
105
110
  "data_type" "document_management"."property_data_type" NOT NULL,
106
111
  "revision" integer NOT NULL,
@@ -108,12 +113,13 @@ CREATE TABLE "document_management"."property" (
108
113
  "create_timestamp" timestamp with time zone NOT NULL,
109
114
  "delete_timestamp" timestamp with time zone,
110
115
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
116
+ CONSTRAINT "property_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
111
117
  CONSTRAINT "property_label_unique" UNIQUE("label"),
112
118
  CONSTRAINT "property_tenant_id_label_unique" UNIQUE("tenant_id","label")
113
119
  );
114
120
  --> statement-breakpoint
115
121
  CREATE TABLE "document_management"."property_value" (
116
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
122
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
117
123
  "tenant_id" uuid NOT NULL,
118
124
  "document_id" uuid NOT NULL,
119
125
  "property_id" uuid NOT NULL,
@@ -127,12 +133,13 @@ CREATE TABLE "document_management"."property_value" (
127
133
  "create_timestamp" timestamp with time zone NOT NULL,
128
134
  "delete_timestamp" timestamp with time zone,
129
135
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
136
+ CONSTRAINT "property_value_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
130
137
  CONSTRAINT "property_value_tenant_id_document_id_property_id_unique" UNIQUE("tenant_id","document_id","property_id"),
131
138
  CONSTRAINT "only_one_value" CHECK (num_nonnulls("document_management"."property_value"."text", "document_management"."property_value"."integer", "document_management"."property_value"."decimal", "document_management"."property_value"."boolean", "document_management"."property_value"."date") = 1)
132
139
  );
133
140
  --> statement-breakpoint
134
141
  CREATE TABLE "document_management"."request" (
135
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
142
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
136
143
  "tenant_id" uuid NOT NULL,
137
144
  "type_id" uuid,
138
145
  "document_id" uuid,
@@ -143,12 +150,13 @@ CREATE TABLE "document_management"."request" (
143
150
  "create_timestamp" timestamp with time zone NOT NULL,
144
151
  "delete_timestamp" timestamp with time zone,
145
152
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
153
+ CONSTRAINT "request_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
146
154
  CONSTRAINT "request_document_id_unique" UNIQUE("document_id"),
147
155
  CONSTRAINT "request_tenant_id_id_unique" UNIQUE("tenant_id","id")
148
156
  );
149
157
  --> statement-breakpoint
150
158
  CREATE TABLE "document_management"."request_collection_assignment" (
151
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
159
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
152
160
  "tenant_id" uuid NOT NULL,
153
161
  "request_id" uuid NOT NULL,
154
162
  "collection_id" uuid NOT NULL,
@@ -157,12 +165,13 @@ CREATE TABLE "document_management"."request_collection_assignment" (
157
165
  "create_timestamp" timestamp with time zone NOT NULL,
158
166
  "delete_timestamp" timestamp with time zone,
159
167
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
168
+ CONSTRAINT "request_collection_assignment_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
160
169
  CONSTRAINT "rca_tenant_id_request_id_collection_id_unique" UNIQUE("tenant_id","request_id","collection_id")
161
170
  );
162
171
  --> statement-breakpoint
163
172
  CREATE TABLE "document_management"."request_template" (
164
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
165
- "tenant_id" uuid,
173
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
174
+ "tenant_id" uuid NOT NULL,
166
175
  "requests_template_id" uuid NOT NULL,
167
176
  "type_id" uuid NOT NULL,
168
177
  "comment" text,
@@ -170,35 +179,38 @@ CREATE TABLE "document_management"."request_template" (
170
179
  "revision_timestamp" timestamp with time zone NOT NULL,
171
180
  "create_timestamp" timestamp with time zone NOT NULL,
172
181
  "delete_timestamp" timestamp with time zone,
173
- "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL
182
+ "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
183
+ CONSTRAINT "request_template_tenant_id_id_pk" PRIMARY KEY("tenant_id","id")
174
184
  );
175
185
  --> statement-breakpoint
176
186
  CREATE TABLE "document_management"."requests_template" (
177
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
178
- "tenant_id" uuid,
187
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
188
+ "tenant_id" uuid NOT NULL,
179
189
  "label" text NOT NULL,
180
190
  "description" text,
181
191
  "revision" integer NOT NULL,
182
192
  "revision_timestamp" timestamp with time zone NOT NULL,
183
193
  "create_timestamp" timestamp with time zone NOT NULL,
184
194
  "delete_timestamp" timestamp with time zone,
185
- "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL
195
+ "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
196
+ CONSTRAINT "requests_template_tenant_id_id_pk" PRIMARY KEY("tenant_id","id")
186
197
  );
187
198
  --> statement-breakpoint
188
199
  CREATE TABLE "document_management"."tag" (
189
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
190
- "tenant_id" uuid,
200
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
201
+ "tenant_id" uuid NOT NULL,
191
202
  "label" text NOT NULL,
192
203
  "revision" integer NOT NULL,
193
204
  "revision_timestamp" timestamp with time zone NOT NULL,
194
205
  "create_timestamp" timestamp with time zone NOT NULL,
195
206
  "delete_timestamp" timestamp with time zone,
196
207
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
208
+ CONSTRAINT "tag_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
197
209
  CONSTRAINT "tag_tenant_id_label_unique" UNIQUE("tenant_id","label")
198
210
  );
199
211
  --> statement-breakpoint
200
212
  CREATE TABLE "document_management"."tag_assignment" (
201
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
213
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
202
214
  "tenant_id" uuid NOT NULL,
203
215
  "document_id" uuid NOT NULL,
204
216
  "tag_id" uuid NOT NULL,
@@ -207,12 +219,13 @@ CREATE TABLE "document_management"."tag_assignment" (
207
219
  "create_timestamp" timestamp with time zone NOT NULL,
208
220
  "delete_timestamp" timestamp with time zone,
209
221
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
222
+ CONSTRAINT "tag_assignment_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
210
223
  CONSTRAINT "tag_assignment_tenant_id_document_id_tag_id_unique" UNIQUE("tenant_id","document_id","tag_id")
211
224
  );
212
225
  --> statement-breakpoint
213
226
  CREATE TABLE "document_management"."type" (
214
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
215
- "tenant_id" uuid,
227
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
228
+ "tenant_id" uuid NOT NULL,
216
229
  "category_id" uuid NOT NULL,
217
230
  "label" text NOT NULL,
218
231
  "revision" integer NOT NULL,
@@ -220,12 +233,13 @@ CREATE TABLE "document_management"."type" (
220
233
  "create_timestamp" timestamp with time zone NOT NULL,
221
234
  "delete_timestamp" timestamp with time zone,
222
235
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
236
+ CONSTRAINT "type_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
223
237
  CONSTRAINT "type_tenant_id_category_id_label_unique" UNIQUE("tenant_id","category_id","label")
224
238
  );
225
239
  --> statement-breakpoint
226
240
  CREATE TABLE "document_management"."type_property" (
227
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
228
- "tenant_id" uuid,
241
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
242
+ "tenant_id" uuid NOT NULL,
229
243
  "type_id" uuid NOT NULL,
230
244
  "property_id" uuid NOT NULL,
231
245
  "revision" integer NOT NULL,
@@ -233,12 +247,13 @@ CREATE TABLE "document_management"."type_property" (
233
247
  "create_timestamp" timestamp with time zone NOT NULL,
234
248
  "delete_timestamp" timestamp with time zone,
235
249
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
250
+ CONSTRAINT "type_property_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
236
251
  CONSTRAINT "type_property_tenant_id_type_id_property_id_unique" UNIQUE("tenant_id","type_id","property_id")
237
252
  );
238
253
  --> statement-breakpoint
239
254
  CREATE TABLE "document_management"."document_type_validation" (
240
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
241
- "tenant_id" uuid,
255
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
256
+ "tenant_id" uuid NOT NULL,
242
257
  "type_id" uuid NOT NULL,
243
258
  "validation_id" uuid NOT NULL,
244
259
  "revision" integer NOT NULL,
@@ -246,12 +261,13 @@ CREATE TABLE "document_management"."document_type_validation" (
246
261
  "create_timestamp" timestamp with time zone NOT NULL,
247
262
  "delete_timestamp" timestamp with time zone,
248
263
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
264
+ CONSTRAINT "document_type_validation_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
249
265
  CONSTRAINT "document_type_validation_tenant_id_type_id_validation_id_unique" UNIQUE("tenant_id","type_id","validation_id")
250
266
  );
251
267
  --> statement-breakpoint
252
268
  CREATE TABLE "document_management"."validation_definition" (
253
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
254
- "tenant_id" uuid,
269
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
270
+ "tenant_id" uuid NOT NULL,
255
271
  "identifier" text NOT NULL,
256
272
  "label" text NOT NULL,
257
273
  "description" text,
@@ -260,11 +276,12 @@ CREATE TABLE "document_management"."validation_definition" (
260
276
  "revision_timestamp" timestamp with time zone NOT NULL,
261
277
  "create_timestamp" timestamp with time zone NOT NULL,
262
278
  "delete_timestamp" timestamp with time zone,
263
- "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL
279
+ "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
280
+ CONSTRAINT "validation_definition_tenant_id_id_pk" PRIMARY KEY("tenant_id","id")
264
281
  );
265
282
  --> statement-breakpoint
266
283
  CREATE TABLE "document_management"."validation_execution" (
267
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
284
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
268
285
  "tenant_id" uuid NOT NULL,
269
286
  "workflow_id" uuid NOT NULL,
270
287
  "definition_id" uuid NOT NULL,
@@ -278,12 +295,13 @@ CREATE TABLE "document_management"."validation_execution" (
278
295
  "create_timestamp" timestamp with time zone NOT NULL,
279
296
  "delete_timestamp" timestamp with time zone,
280
297
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
298
+ CONSTRAINT "validation_execution_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
281
299
  CONSTRAINT "validation_execution_tenant_id_workflow_id_definition_id_unique" UNIQUE("tenant_id","workflow_id","definition_id"),
282
300
  CONSTRAINT "validation_execution_tenant_id_id_unique" UNIQUE("tenant_id","id")
283
301
  );
284
302
  --> statement-breakpoint
285
303
  CREATE TABLE "document_management"."validation_execution_related_document" (
286
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
304
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
287
305
  "tenant_id" uuid NOT NULL,
288
306
  "execution_id" uuid NOT NULL,
289
307
  "document_id" uuid NOT NULL,
@@ -292,11 +310,12 @@ CREATE TABLE "document_management"."validation_execution_related_document" (
292
310
  "create_timestamp" timestamp with time zone NOT NULL,
293
311
  "delete_timestamp" timestamp with time zone,
294
312
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
313
+ CONSTRAINT "validation_execution_related_document_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
295
314
  CONSTRAINT "verd_tenant_id_execution_id_document_id_unique" UNIQUE("tenant_id","execution_id","document_id")
296
315
  );
297
316
  --> statement-breakpoint
298
317
  CREATE TABLE "document_management"."workflow" (
299
- "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
318
+ "id" uuid DEFAULT gen_random_uuid() NOT NULL,
300
319
  "tenant_id" uuid NOT NULL,
301
320
  "document_id" uuid NOT NULL,
302
321
  "step" "document_management"."workflow_step" NOT NULL,
@@ -309,51 +328,52 @@ CREATE TABLE "document_management"."workflow" (
309
328
  "create_timestamp" timestamp with time zone NOT NULL,
310
329
  "delete_timestamp" timestamp with time zone,
311
330
  "attributes" jsonb DEFAULT '{}'::jsonb NOT NULL,
331
+ CONSTRAINT "workflow_tenant_id_id_pk" PRIMARY KEY("tenant_id","id"),
312
332
  CONSTRAINT "workflow_tenant_id_id_unique" UNIQUE("tenant_id","id")
313
333
  );
314
334
  --> statement-breakpoint
315
- ALTER TABLE "document_management"."document" ADD CONSTRAINT "document_type_id_type_id_fk" FOREIGN KEY ("type_id") REFERENCES "document_management"."type"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
316
- ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_task_id_assignment_task_id_fk" FOREIGN KEY ("task_id") REFERENCES "document_management"."assignment_task"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
317
- ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_collection_id_collection_id_fk" FOREIGN KEY ("collection_id") REFERENCES "document_management"."collection"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
318
- ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_tenantId_collectionId_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
319
- ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_tenantId_taskId_fkey" FOREIGN KEY ("tenant_id","task_id") REFERENCES "document_management"."assignment_task"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
320
- ALTER TABLE "document_management"."assignment_task" ADD CONSTRAINT "assignment_task_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
321
- ALTER TABLE "document_management"."assignment_task" ADD CONSTRAINT "assignment_task_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
322
- ALTER TABLE "document_management"."category" ADD CONSTRAINT "category_parent_id_category_id_fk" FOREIGN KEY ("parent_id") REFERENCES "document_management"."category"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
323
- ALTER TABLE "document_management"."collection" ADD CONSTRAINT "collection_parent_id_collection_id_fk" FOREIGN KEY ("parent_id") REFERENCES "document_management"."collection"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
324
- ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_collection_id_collection_id_fk" FOREIGN KEY ("collection_id") REFERENCES "document_management"."collection"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
325
- ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
326
- ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
327
- ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_tenantId_collectionId_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
328
- ALTER TABLE "document_management"."property_value" ADD CONSTRAINT "property_value_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
329
- ALTER TABLE "document_management"."property_value" ADD CONSTRAINT "property_value_property_id_property_id_fk" FOREIGN KEY ("property_id") REFERENCES "document_management"."property"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
330
- ALTER TABLE "document_management"."property_value" ADD CONSTRAINT "property_value_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
331
- ALTER TABLE "document_management"."request" ADD CONSTRAINT "request_type_id_type_id_fk" FOREIGN KEY ("type_id") REFERENCES "document_management"."type"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
332
- ALTER TABLE "document_management"."request" ADD CONSTRAINT "request_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
333
- ALTER TABLE "document_management"."request" ADD CONSTRAINT "request_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
334
- ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_request_id_request_id_fk" FOREIGN KEY ("request_id") REFERENCES "document_management"."request"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
335
- ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_collection_id_collection_id_fk" FOREIGN KEY ("collection_id") REFERENCES "document_management"."collection"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
336
- ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_tenantId_collectionId_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
337
- ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_tenantId_requestId_fkey" FOREIGN KEY ("tenant_id","request_id") REFERENCES "document_management"."request"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
338
- ALTER TABLE "document_management"."request_template" ADD CONSTRAINT "request_template_requests_template_id_requests_template_id_fk" FOREIGN KEY ("requests_template_id") REFERENCES "document_management"."requests_template"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
339
- ALTER TABLE "document_management"."request_template" ADD CONSTRAINT "request_template_type_id_type_id_fk" FOREIGN KEY ("type_id") REFERENCES "document_management"."type"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
340
- ALTER TABLE "document_management"."tag_assignment" ADD CONSTRAINT "tag_assignment_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
341
- ALTER TABLE "document_management"."tag_assignment" ADD CONSTRAINT "tag_assignment_tag_id_tag_id_fk" FOREIGN KEY ("tag_id") REFERENCES "document_management"."tag"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
342
- ALTER TABLE "document_management"."tag_assignment" ADD CONSTRAINT "tag_assignment_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
343
- ALTER TABLE "document_management"."type" ADD CONSTRAINT "type_category_id_category_id_fk" FOREIGN KEY ("category_id") REFERENCES "document_management"."category"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
344
- ALTER TABLE "document_management"."type_property" ADD CONSTRAINT "type_property_type_id_type_id_fk" FOREIGN KEY ("type_id") REFERENCES "document_management"."type"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
345
- ALTER TABLE "document_management"."type_property" ADD CONSTRAINT "type_property_property_id_property_id_fk" FOREIGN KEY ("property_id") REFERENCES "document_management"."property"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
346
- ALTER TABLE "document_management"."document_type_validation" ADD CONSTRAINT "document_type_validation_type_id_type_id_fk" FOREIGN KEY ("type_id") REFERENCES "document_management"."type"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
347
- ALTER TABLE "document_management"."document_type_validation" ADD CONSTRAINT "document_type_validation_validation_id_validation_definition_id_fk" FOREIGN KEY ("validation_id") REFERENCES "document_management"."validation_definition"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
348
- ALTER TABLE "document_management"."validation_execution" ADD CONSTRAINT "validation_execution_workflow_id_workflow_id_fk" FOREIGN KEY ("workflow_id") REFERENCES "document_management"."workflow"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
349
- ALTER TABLE "document_management"."validation_execution" ADD CONSTRAINT "validation_execution_definition_id_validation_definition_id_fk" FOREIGN KEY ("definition_id") REFERENCES "document_management"."validation_definition"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
350
- ALTER TABLE "document_management"."validation_execution" ADD CONSTRAINT "validation_execution_tenantId_workflowId_fkey" FOREIGN KEY ("tenant_id","workflow_id") REFERENCES "document_management"."workflow"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
351
- ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "validation_execution_related_document_execution_id_validation_execution_id_fk" FOREIGN KEY ("execution_id") REFERENCES "document_management"."validation_execution"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
352
- ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "validation_execution_related_document_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
353
- ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "validation_execution_related_document_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
354
- ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "validation_execution_related_document_tenantId_executionId_fkey" FOREIGN KEY ("tenant_id","execution_id") REFERENCES "document_management"."validation_execution"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
355
- ALTER TABLE "document_management"."workflow" ADD CONSTRAINT "workflow_document_id_document_id_fk" FOREIGN KEY ("document_id") REFERENCES "document_management"."document"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
356
- ALTER TABLE "document_management"."workflow" ADD CONSTRAINT "workflow_tenantId_documentId_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
335
+ ALTER TABLE "document_management"."document" ADD CONSTRAINT "document_id_type_fkey" FOREIGN KEY ("tenant_id","type_id") REFERENCES "document_management"."type"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
336
+ ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_id_assignment_task_fkey" FOREIGN KEY ("tenant_id","task_id") REFERENCES "document_management"."assignment_task"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
337
+ ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_id_collection_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
338
+ ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_tenantId_collectionId_collection_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
339
+ ALTER TABLE "document_management"."assignment_scope" ADD CONSTRAINT "assignment_scope_tenantId_taskId_assignment_task_fkey" FOREIGN KEY ("tenant_id","task_id") REFERENCES "document_management"."assignment_task"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
340
+ ALTER TABLE "document_management"."assignment_task" ADD CONSTRAINT "assignment_task_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
341
+ ALTER TABLE "document_management"."assignment_task" ADD CONSTRAINT "assignment_task_tenantId_documentId_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
342
+ ALTER TABLE "document_management"."category" ADD CONSTRAINT "category_id_category_fkey" FOREIGN KEY ("tenant_id","parent_id") REFERENCES "document_management"."category"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
343
+ ALTER TABLE "document_management"."collection" ADD CONSTRAINT "collection_id_collection_fkey" FOREIGN KEY ("tenant_id","parent_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
344
+ ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_id_collection_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
345
+ ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
346
+ ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_tenantId_documentId_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
347
+ ALTER TABLE "document_management"."collection_assignment" ADD CONSTRAINT "collection_assignment_tenantId_collectionId_collection_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
348
+ ALTER TABLE "document_management"."property_value" ADD CONSTRAINT "property_value_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
349
+ ALTER TABLE "document_management"."property_value" ADD CONSTRAINT "property_value_id_property_fkey" FOREIGN KEY ("tenant_id","property_id") REFERENCES "document_management"."property"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
350
+ ALTER TABLE "document_management"."property_value" ADD CONSTRAINT "property_value_tenantId_documentId_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
351
+ ALTER TABLE "document_management"."request" ADD CONSTRAINT "request_id_type_fkey" FOREIGN KEY ("tenant_id","type_id") REFERENCES "document_management"."type"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
352
+ ALTER TABLE "document_management"."request" ADD CONSTRAINT "request_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
353
+ ALTER TABLE "document_management"."request" ADD CONSTRAINT "request_tenantId_documentId_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
354
+ ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_id_request_fkey" FOREIGN KEY ("tenant_id","request_id") REFERENCES "document_management"."request"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
355
+ ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_id_collection_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
356
+ ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "rca_tenantId_collectionId_c_fkey" FOREIGN KEY ("tenant_id","collection_id") REFERENCES "document_management"."collection"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
357
+ ALTER TABLE "document_management"."request_collection_assignment" ADD CONSTRAINT "request_collection_assignment_tenantId_requestId_request_fkey" FOREIGN KEY ("tenant_id","request_id") REFERENCES "document_management"."request"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
358
+ ALTER TABLE "document_management"."request_template" ADD CONSTRAINT "request_template_id_requests_template_fkey" FOREIGN KEY ("tenant_id","requests_template_id") REFERENCES "document_management"."requests_template"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
359
+ ALTER TABLE "document_management"."request_template" ADD CONSTRAINT "request_template_id_type_fkey" FOREIGN KEY ("tenant_id","type_id") REFERENCES "document_management"."type"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
360
+ ALTER TABLE "document_management"."tag_assignment" ADD CONSTRAINT "tag_assignment_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
361
+ ALTER TABLE "document_management"."tag_assignment" ADD CONSTRAINT "tag_assignment_id_tag_fkey" FOREIGN KEY ("tenant_id","tag_id") REFERENCES "document_management"."tag"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
362
+ ALTER TABLE "document_management"."tag_assignment" ADD CONSTRAINT "tag_assignment_tenantId_documentId_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
363
+ ALTER TABLE "document_management"."type" ADD CONSTRAINT "type_id_category_fkey" FOREIGN KEY ("tenant_id","category_id") REFERENCES "document_management"."category"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
364
+ ALTER TABLE "document_management"."type_property" ADD CONSTRAINT "type_property_id_type_fkey" FOREIGN KEY ("tenant_id","type_id") REFERENCES "document_management"."type"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
365
+ ALTER TABLE "document_management"."type_property" ADD CONSTRAINT "type_property_id_property_fkey" FOREIGN KEY ("tenant_id","property_id") REFERENCES "document_management"."property"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
366
+ ALTER TABLE "document_management"."document_type_validation" ADD CONSTRAINT "document_type_validation_id_type_fkey" FOREIGN KEY ("tenant_id","type_id") REFERENCES "document_management"."type"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
367
+ ALTER TABLE "document_management"."document_type_validation" ADD CONSTRAINT "document_type_validation_id_validation_definition_fkey" FOREIGN KEY ("tenant_id","validation_id") REFERENCES "document_management"."validation_definition"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
368
+ ALTER TABLE "document_management"."validation_execution" ADD CONSTRAINT "validation_execution_id_workflow_fkey" FOREIGN KEY ("tenant_id","workflow_id") REFERENCES "document_management"."workflow"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
369
+ ALTER TABLE "document_management"."validation_execution" ADD CONSTRAINT "validation_execution_id_validation_definition_fkey" FOREIGN KEY ("tenant_id","definition_id") REFERENCES "document_management"."validation_definition"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
370
+ ALTER TABLE "document_management"."validation_execution" ADD CONSTRAINT "validation_execution_tenantId_workflowId_workflow_fkey" FOREIGN KEY ("tenant_id","workflow_id") REFERENCES "document_management"."workflow"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
371
+ ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "verd_id_ve_fkey" FOREIGN KEY ("tenant_id","execution_id") REFERENCES "document_management"."validation_execution"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
372
+ ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "validation_execution_related_document_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
373
+ ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "verd_tenantId_documentId_d_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
374
+ ALTER TABLE "document_management"."validation_execution_related_document" ADD CONSTRAINT "verd_tenantId_executionId_ve_fkey" FOREIGN KEY ("tenant_id","execution_id") REFERENCES "document_management"."validation_execution"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
375
+ ALTER TABLE "document_management"."workflow" ADD CONSTRAINT "workflow_id_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
376
+ ALTER TABLE "document_management"."workflow" ADD CONSTRAINT "workflow_tenantId_documentId_document_fkey" FOREIGN KEY ("tenant_id","document_id") REFERENCES "document_management"."document"("tenant_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
357
377
  CREATE INDEX "collection_assignment_collection_id_idx" ON "document_management"."collection_assignment" USING btree ("collection_id");--> statement-breakpoint
358
378
  CREATE INDEX "request_type_id_idx" ON "document_management"."request" USING btree ("type_id");--> statement-breakpoint
359
379
  CREATE INDEX "request_state_idx" ON "document_management"."request" USING btree ("state");--> statement-breakpoint