@pgpmjs/core 4.10.1 → 4.11.0
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/esm/export/export-meta.js +628 -9
- package/export/export-meta.js +628 -9
- package/package.json +2 -2
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Parser } from 'csv-to-pg';
|
|
2
2
|
import { getPgPool } from 'pg-cache';
|
|
3
3
|
const config = {
|
|
4
|
+
// =============================================================================
|
|
5
|
+
// metaschema_public tables
|
|
6
|
+
// =============================================================================
|
|
4
7
|
database: {
|
|
5
8
|
schema: 'metaschema_public',
|
|
6
9
|
table: 'database',
|
|
@@ -53,6 +56,183 @@ const config = {
|
|
|
53
56
|
description: 'text'
|
|
54
57
|
}
|
|
55
58
|
},
|
|
59
|
+
policy: {
|
|
60
|
+
schema: 'metaschema_public',
|
|
61
|
+
table: 'policy',
|
|
62
|
+
fields: {
|
|
63
|
+
id: 'uuid',
|
|
64
|
+
database_id: 'uuid',
|
|
65
|
+
table_id: 'uuid',
|
|
66
|
+
name: 'text',
|
|
67
|
+
role_name: 'text',
|
|
68
|
+
privilege: 'text',
|
|
69
|
+
permissive: 'boolean',
|
|
70
|
+
disabled: 'boolean',
|
|
71
|
+
template: 'text',
|
|
72
|
+
data: 'jsonb'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
index: {
|
|
76
|
+
schema: 'metaschema_public',
|
|
77
|
+
table: 'index',
|
|
78
|
+
fields: {
|
|
79
|
+
id: 'uuid',
|
|
80
|
+
database_id: 'uuid',
|
|
81
|
+
table_id: 'uuid',
|
|
82
|
+
name: 'text',
|
|
83
|
+
field_ids: 'uuid[]',
|
|
84
|
+
include_field_ids: 'uuid[]',
|
|
85
|
+
access_method: 'text',
|
|
86
|
+
index_params: 'jsonb',
|
|
87
|
+
where_clause: 'jsonb',
|
|
88
|
+
is_unique: 'boolean'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
trigger: {
|
|
92
|
+
schema: 'metaschema_public',
|
|
93
|
+
table: 'trigger',
|
|
94
|
+
fields: {
|
|
95
|
+
id: 'uuid',
|
|
96
|
+
database_id: 'uuid',
|
|
97
|
+
table_id: 'uuid',
|
|
98
|
+
name: 'text',
|
|
99
|
+
event: 'text',
|
|
100
|
+
function_name: 'text'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
trigger_function: {
|
|
104
|
+
schema: 'metaschema_public',
|
|
105
|
+
table: 'trigger_function',
|
|
106
|
+
fields: {
|
|
107
|
+
id: 'uuid',
|
|
108
|
+
database_id: 'uuid',
|
|
109
|
+
schema_id: 'uuid',
|
|
110
|
+
name: 'text'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
rls_function: {
|
|
114
|
+
schema: 'metaschema_public',
|
|
115
|
+
table: 'rls_function',
|
|
116
|
+
fields: {
|
|
117
|
+
id: 'uuid',
|
|
118
|
+
database_id: 'uuid',
|
|
119
|
+
schema_id: 'uuid',
|
|
120
|
+
name: 'text'
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
limit_function: {
|
|
124
|
+
schema: 'metaschema_public',
|
|
125
|
+
table: 'limit_function',
|
|
126
|
+
fields: {
|
|
127
|
+
id: 'uuid',
|
|
128
|
+
database_id: 'uuid',
|
|
129
|
+
schema_id: 'uuid',
|
|
130
|
+
name: 'text'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
procedure: {
|
|
134
|
+
schema: 'metaschema_public',
|
|
135
|
+
table: 'procedure',
|
|
136
|
+
fields: {
|
|
137
|
+
id: 'uuid',
|
|
138
|
+
database_id: 'uuid',
|
|
139
|
+
schema_id: 'uuid',
|
|
140
|
+
name: 'text'
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
foreign_key_constraint: {
|
|
144
|
+
schema: 'metaschema_public',
|
|
145
|
+
table: 'foreign_key_constraint',
|
|
146
|
+
fields: {
|
|
147
|
+
id: 'uuid',
|
|
148
|
+
database_id: 'uuid',
|
|
149
|
+
table_id: 'uuid',
|
|
150
|
+
name: 'text',
|
|
151
|
+
field_ids: 'uuid[]',
|
|
152
|
+
ref_table_id: 'uuid',
|
|
153
|
+
ref_field_ids: 'uuid[]',
|
|
154
|
+
on_delete: 'text',
|
|
155
|
+
on_update: 'text'
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
primary_key_constraint: {
|
|
159
|
+
schema: 'metaschema_public',
|
|
160
|
+
table: 'primary_key_constraint',
|
|
161
|
+
fields: {
|
|
162
|
+
id: 'uuid',
|
|
163
|
+
database_id: 'uuid',
|
|
164
|
+
table_id: 'uuid',
|
|
165
|
+
name: 'text',
|
|
166
|
+
field_ids: 'uuid[]'
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
unique_constraint: {
|
|
170
|
+
schema: 'metaschema_public',
|
|
171
|
+
table: 'unique_constraint',
|
|
172
|
+
fields: {
|
|
173
|
+
id: 'uuid',
|
|
174
|
+
database_id: 'uuid',
|
|
175
|
+
table_id: 'uuid',
|
|
176
|
+
name: 'text',
|
|
177
|
+
field_ids: 'uuid[]'
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
check_constraint: {
|
|
181
|
+
schema: 'metaschema_public',
|
|
182
|
+
table: 'check_constraint',
|
|
183
|
+
fields: {
|
|
184
|
+
id: 'uuid',
|
|
185
|
+
database_id: 'uuid',
|
|
186
|
+
table_id: 'uuid',
|
|
187
|
+
name: 'text',
|
|
188
|
+
expression: 'text'
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
full_text_search: {
|
|
192
|
+
schema: 'metaschema_public',
|
|
193
|
+
table: 'full_text_search',
|
|
194
|
+
fields: {
|
|
195
|
+
id: 'uuid',
|
|
196
|
+
database_id: 'uuid',
|
|
197
|
+
table_id: 'uuid',
|
|
198
|
+
name: 'text',
|
|
199
|
+
field_ids: 'uuid[]',
|
|
200
|
+
weights: 'text[]'
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
schema_grant: {
|
|
204
|
+
schema: 'metaschema_public',
|
|
205
|
+
table: 'schema_grant',
|
|
206
|
+
fields: {
|
|
207
|
+
id: 'uuid',
|
|
208
|
+
database_id: 'uuid',
|
|
209
|
+
schema_id: 'uuid',
|
|
210
|
+
role_name: 'text',
|
|
211
|
+
privilege: 'text'
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
table_grant: {
|
|
215
|
+
schema: 'metaschema_public',
|
|
216
|
+
table: 'table_grant',
|
|
217
|
+
fields: {
|
|
218
|
+
id: 'uuid',
|
|
219
|
+
database_id: 'uuid',
|
|
220
|
+
table_id: 'uuid',
|
|
221
|
+
role_name: 'text',
|
|
222
|
+
privilege: 'text'
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
extension: {
|
|
226
|
+
schema: 'metaschema_public',
|
|
227
|
+
table: 'extension',
|
|
228
|
+
fields: {
|
|
229
|
+
id: 'uuid',
|
|
230
|
+
name: 'text'
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
// =============================================================================
|
|
234
|
+
// services_public tables
|
|
235
|
+
// =============================================================================
|
|
56
236
|
domains: {
|
|
57
237
|
schema: 'services_public',
|
|
58
238
|
table: 'domains',
|
|
@@ -129,6 +309,18 @@ const config = {
|
|
|
129
309
|
theme: 'jsonb'
|
|
130
310
|
}
|
|
131
311
|
},
|
|
312
|
+
site_metadata: {
|
|
313
|
+
schema: 'services_public',
|
|
314
|
+
table: 'site_metadata',
|
|
315
|
+
fields: {
|
|
316
|
+
id: 'uuid',
|
|
317
|
+
database_id: 'uuid',
|
|
318
|
+
site_id: 'uuid',
|
|
319
|
+
title: 'text',
|
|
320
|
+
description: 'text',
|
|
321
|
+
og_image: 'image'
|
|
322
|
+
}
|
|
323
|
+
},
|
|
132
324
|
api_modules: {
|
|
133
325
|
schema: 'services_public',
|
|
134
326
|
table: 'api_modules',
|
|
@@ -160,6 +352,9 @@ const config = {
|
|
|
160
352
|
api_id: 'uuid'
|
|
161
353
|
}
|
|
162
354
|
},
|
|
355
|
+
// =============================================================================
|
|
356
|
+
// metaschema_modules_public tables
|
|
357
|
+
// =============================================================================
|
|
163
358
|
rls_module: {
|
|
164
359
|
schema: 'metaschema_modules_public',
|
|
165
360
|
table: 'rls_module',
|
|
@@ -203,6 +398,375 @@ const config = {
|
|
|
203
398
|
send_verification_email_function: 'text',
|
|
204
399
|
verify_email_function: 'text'
|
|
205
400
|
}
|
|
401
|
+
},
|
|
402
|
+
memberships_module: {
|
|
403
|
+
schema: 'metaschema_modules_public',
|
|
404
|
+
table: 'memberships_module',
|
|
405
|
+
fields: {
|
|
406
|
+
id: 'uuid',
|
|
407
|
+
database_id: 'uuid',
|
|
408
|
+
schema_id: 'uuid',
|
|
409
|
+
private_schema_id: 'uuid',
|
|
410
|
+
memberships_table_id: 'uuid',
|
|
411
|
+
memberships_table_name: 'text',
|
|
412
|
+
members_table_id: 'uuid',
|
|
413
|
+
members_table_name: 'text',
|
|
414
|
+
membership_defaults_table_id: 'uuid',
|
|
415
|
+
membership_defaults_table_name: 'text',
|
|
416
|
+
grants_table_id: 'uuid',
|
|
417
|
+
grants_table_name: 'text',
|
|
418
|
+
actor_table_id: 'uuid',
|
|
419
|
+
limits_table_id: 'uuid',
|
|
420
|
+
default_limits_table_id: 'uuid',
|
|
421
|
+
permissions_table_id: 'uuid',
|
|
422
|
+
default_permissions_table_id: 'uuid',
|
|
423
|
+
sprt_table_id: 'uuid',
|
|
424
|
+
admin_grants_table_id: 'uuid',
|
|
425
|
+
admin_grants_table_name: 'text',
|
|
426
|
+
owner_grants_table_id: 'uuid',
|
|
427
|
+
owner_grants_table_name: 'text',
|
|
428
|
+
membership_type: 'int',
|
|
429
|
+
entity_table_id: 'uuid',
|
|
430
|
+
entity_table_owner_id: 'uuid',
|
|
431
|
+
prefix: 'text',
|
|
432
|
+
actor_mask_check: 'text',
|
|
433
|
+
actor_perm_check: 'text',
|
|
434
|
+
entity_ids_by_mask: 'text',
|
|
435
|
+
entity_ids_by_perm: 'text',
|
|
436
|
+
entity_ids_function: 'text'
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
permissions_module: {
|
|
440
|
+
schema: 'metaschema_modules_public',
|
|
441
|
+
table: 'permissions_module',
|
|
442
|
+
fields: {
|
|
443
|
+
id: 'uuid',
|
|
444
|
+
database_id: 'uuid',
|
|
445
|
+
schema_id: 'uuid',
|
|
446
|
+
private_schema_id: 'uuid',
|
|
447
|
+
table_id: 'uuid',
|
|
448
|
+
table_name: 'text',
|
|
449
|
+
default_table_id: 'uuid',
|
|
450
|
+
default_table_name: 'text',
|
|
451
|
+
bitlen: 'int',
|
|
452
|
+
membership_type: 'int',
|
|
453
|
+
entity_table_id: 'uuid',
|
|
454
|
+
actor_table_id: 'uuid',
|
|
455
|
+
prefix: 'text',
|
|
456
|
+
get_padded_mask: 'text',
|
|
457
|
+
get_mask: 'text',
|
|
458
|
+
get_by_mask: 'text',
|
|
459
|
+
get_mask_by_name: 'text'
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
limits_module: {
|
|
463
|
+
schema: 'metaschema_modules_public',
|
|
464
|
+
table: 'limits_module',
|
|
465
|
+
fields: {
|
|
466
|
+
id: 'uuid',
|
|
467
|
+
database_id: 'uuid',
|
|
468
|
+
schema_id: 'uuid',
|
|
469
|
+
private_schema_id: 'uuid',
|
|
470
|
+
table_id: 'uuid',
|
|
471
|
+
table_name: 'text',
|
|
472
|
+
default_table_id: 'uuid',
|
|
473
|
+
default_table_name: 'text',
|
|
474
|
+
limit_increment_function: 'text',
|
|
475
|
+
limit_decrement_function: 'text',
|
|
476
|
+
limit_increment_trigger: 'text',
|
|
477
|
+
limit_decrement_trigger: 'text',
|
|
478
|
+
limit_update_trigger: 'text',
|
|
479
|
+
limit_check_function: 'text',
|
|
480
|
+
prefix: 'text',
|
|
481
|
+
membership_type: 'int',
|
|
482
|
+
entity_table_id: 'uuid',
|
|
483
|
+
actor_table_id: 'uuid'
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
levels_module: {
|
|
487
|
+
schema: 'metaschema_modules_public',
|
|
488
|
+
table: 'levels_module',
|
|
489
|
+
fields: {
|
|
490
|
+
id: 'uuid',
|
|
491
|
+
database_id: 'uuid',
|
|
492
|
+
schema_id: 'uuid',
|
|
493
|
+
private_schema_id: 'uuid',
|
|
494
|
+
steps_table_id: 'uuid',
|
|
495
|
+
steps_table_name: 'text',
|
|
496
|
+
achievements_table_id: 'uuid',
|
|
497
|
+
achievements_table_name: 'text',
|
|
498
|
+
levels_table_id: 'uuid',
|
|
499
|
+
levels_table_name: 'text',
|
|
500
|
+
level_requirements_table_id: 'uuid',
|
|
501
|
+
level_requirements_table_name: 'text',
|
|
502
|
+
completed_step: 'text',
|
|
503
|
+
incompleted_step: 'text',
|
|
504
|
+
tg_achievement: 'text',
|
|
505
|
+
tg_achievement_toggle: 'text',
|
|
506
|
+
tg_achievement_toggle_boolean: 'text',
|
|
507
|
+
tg_achievement_boolean: 'text',
|
|
508
|
+
upsert_achievement: 'text',
|
|
509
|
+
tg_update_achievements: 'text',
|
|
510
|
+
steps_required: 'text',
|
|
511
|
+
level_achieved: 'text',
|
|
512
|
+
prefix: 'text',
|
|
513
|
+
membership_type: 'int',
|
|
514
|
+
entity_table_id: 'uuid',
|
|
515
|
+
actor_table_id: 'uuid'
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
users_module: {
|
|
519
|
+
schema: 'metaschema_modules_public',
|
|
520
|
+
table: 'users_module',
|
|
521
|
+
fields: {
|
|
522
|
+
id: 'uuid',
|
|
523
|
+
database_id: 'uuid',
|
|
524
|
+
schema_id: 'uuid',
|
|
525
|
+
table_id: 'uuid',
|
|
526
|
+
table_name: 'text',
|
|
527
|
+
type_table_id: 'uuid',
|
|
528
|
+
type_table_name: 'text'
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
hierarchy_module: {
|
|
532
|
+
schema: 'metaschema_modules_public',
|
|
533
|
+
table: 'hierarchy_module',
|
|
534
|
+
fields: {
|
|
535
|
+
id: 'uuid',
|
|
536
|
+
database_id: 'uuid',
|
|
537
|
+
schema_id: 'uuid',
|
|
538
|
+
private_schema_id: 'uuid',
|
|
539
|
+
chart_edges_table_id: 'uuid',
|
|
540
|
+
chart_edges_table_name: 'text',
|
|
541
|
+
hierarchy_sprt_table_id: 'uuid',
|
|
542
|
+
hierarchy_sprt_table_name: 'text',
|
|
543
|
+
chart_edge_grants_table_id: 'uuid',
|
|
544
|
+
chart_edge_grants_table_name: 'text',
|
|
545
|
+
entity_table_id: 'uuid',
|
|
546
|
+
users_table_id: 'uuid',
|
|
547
|
+
prefix: 'text',
|
|
548
|
+
private_schema_name: 'text',
|
|
549
|
+
sprt_table_name: 'text',
|
|
550
|
+
rebuild_hierarchy_function: 'text',
|
|
551
|
+
get_subordinates_function: 'text',
|
|
552
|
+
get_managers_function: 'text',
|
|
553
|
+
is_manager_of_function: 'text',
|
|
554
|
+
created_at: 'timestamptz'
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
membership_types_module: {
|
|
558
|
+
schema: 'metaschema_modules_public',
|
|
559
|
+
table: 'membership_types_module',
|
|
560
|
+
fields: {
|
|
561
|
+
id: 'uuid',
|
|
562
|
+
database_id: 'uuid',
|
|
563
|
+
schema_id: 'uuid',
|
|
564
|
+
table_id: 'uuid',
|
|
565
|
+
table_name: 'text'
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
invites_module: {
|
|
569
|
+
schema: 'metaschema_modules_public',
|
|
570
|
+
table: 'invites_module',
|
|
571
|
+
fields: {
|
|
572
|
+
id: 'uuid',
|
|
573
|
+
database_id: 'uuid',
|
|
574
|
+
schema_id: 'uuid',
|
|
575
|
+
private_schema_id: 'uuid',
|
|
576
|
+
emails_table_id: 'uuid',
|
|
577
|
+
users_table_id: 'uuid',
|
|
578
|
+
invites_table_id: 'uuid',
|
|
579
|
+
claimed_invites_table_id: 'uuid',
|
|
580
|
+
invites_table_name: 'text',
|
|
581
|
+
claimed_invites_table_name: 'text',
|
|
582
|
+
submit_invite_code_function: 'text',
|
|
583
|
+
prefix: 'text',
|
|
584
|
+
membership_type: 'int',
|
|
585
|
+
entity_table_id: 'uuid'
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
emails_module: {
|
|
589
|
+
schema: 'metaschema_modules_public',
|
|
590
|
+
table: 'emails_module',
|
|
591
|
+
fields: {
|
|
592
|
+
id: 'uuid',
|
|
593
|
+
database_id: 'uuid',
|
|
594
|
+
schema_id: 'uuid',
|
|
595
|
+
private_schema_id: 'uuid',
|
|
596
|
+
table_id: 'uuid',
|
|
597
|
+
owner_table_id: 'uuid',
|
|
598
|
+
table_name: 'text'
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
tokens_module: {
|
|
602
|
+
schema: 'metaschema_modules_public',
|
|
603
|
+
table: 'tokens_module',
|
|
604
|
+
fields: {
|
|
605
|
+
id: 'uuid',
|
|
606
|
+
database_id: 'uuid',
|
|
607
|
+
schema_id: 'uuid',
|
|
608
|
+
table_id: 'uuid',
|
|
609
|
+
owned_table_id: 'uuid',
|
|
610
|
+
tokens_default_expiration: 'interval',
|
|
611
|
+
tokens_table: 'text'
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
secrets_module: {
|
|
615
|
+
schema: 'metaschema_modules_public',
|
|
616
|
+
table: 'secrets_module',
|
|
617
|
+
fields: {
|
|
618
|
+
id: 'uuid',
|
|
619
|
+
database_id: 'uuid',
|
|
620
|
+
schema_id: 'uuid',
|
|
621
|
+
table_id: 'uuid',
|
|
622
|
+
table_name: 'text'
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
profiles_module: {
|
|
626
|
+
schema: 'metaschema_modules_public',
|
|
627
|
+
table: 'profiles_module',
|
|
628
|
+
fields: {
|
|
629
|
+
id: 'uuid',
|
|
630
|
+
database_id: 'uuid',
|
|
631
|
+
schema_id: 'uuid',
|
|
632
|
+
private_schema_id: 'uuid',
|
|
633
|
+
table_id: 'uuid',
|
|
634
|
+
table_name: 'text',
|
|
635
|
+
profile_permissions_table_id: 'uuid',
|
|
636
|
+
profile_permissions_table_name: 'text',
|
|
637
|
+
profile_grants_table_id: 'uuid',
|
|
638
|
+
profile_grants_table_name: 'text',
|
|
639
|
+
profile_definition_grants_table_id: 'uuid',
|
|
640
|
+
profile_definition_grants_table_name: 'text',
|
|
641
|
+
bitlen: 'int',
|
|
642
|
+
membership_type: 'int',
|
|
643
|
+
entity_table_id: 'uuid',
|
|
644
|
+
actor_table_id: 'uuid',
|
|
645
|
+
permissions_table_id: 'uuid',
|
|
646
|
+
memberships_table_id: 'uuid',
|
|
647
|
+
prefix: 'text'
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
encrypted_secrets_module: {
|
|
651
|
+
schema: 'metaschema_modules_public',
|
|
652
|
+
table: 'encrypted_secrets_module',
|
|
653
|
+
fields: {
|
|
654
|
+
id: 'uuid',
|
|
655
|
+
database_id: 'uuid',
|
|
656
|
+
schema_id: 'uuid',
|
|
657
|
+
table_id: 'uuid',
|
|
658
|
+
table_name: 'text'
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
connected_accounts_module: {
|
|
662
|
+
schema: 'metaschema_modules_public',
|
|
663
|
+
table: 'connected_accounts_module',
|
|
664
|
+
fields: {
|
|
665
|
+
id: 'uuid',
|
|
666
|
+
database_id: 'uuid',
|
|
667
|
+
schema_id: 'uuid',
|
|
668
|
+
private_schema_id: 'uuid',
|
|
669
|
+
table_id: 'uuid',
|
|
670
|
+
owner_table_id: 'uuid',
|
|
671
|
+
table_name: 'text'
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
phone_numbers_module: {
|
|
675
|
+
schema: 'metaschema_modules_public',
|
|
676
|
+
table: 'phone_numbers_module',
|
|
677
|
+
fields: {
|
|
678
|
+
id: 'uuid',
|
|
679
|
+
database_id: 'uuid',
|
|
680
|
+
schema_id: 'uuid',
|
|
681
|
+
private_schema_id: 'uuid',
|
|
682
|
+
table_id: 'uuid',
|
|
683
|
+
owner_table_id: 'uuid',
|
|
684
|
+
table_name: 'text'
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
crypto_addresses_module: {
|
|
688
|
+
schema: 'metaschema_modules_public',
|
|
689
|
+
table: 'crypto_addresses_module',
|
|
690
|
+
fields: {
|
|
691
|
+
id: 'uuid',
|
|
692
|
+
database_id: 'uuid',
|
|
693
|
+
schema_id: 'uuid',
|
|
694
|
+
private_schema_id: 'uuid',
|
|
695
|
+
table_id: 'uuid',
|
|
696
|
+
owner_table_id: 'uuid',
|
|
697
|
+
table_name: 'text',
|
|
698
|
+
crypto_network: 'text'
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
crypto_auth_module: {
|
|
702
|
+
schema: 'metaschema_modules_public',
|
|
703
|
+
table: 'crypto_auth_module',
|
|
704
|
+
fields: {
|
|
705
|
+
id: 'uuid',
|
|
706
|
+
database_id: 'uuid',
|
|
707
|
+
schema_id: 'uuid',
|
|
708
|
+
users_table_id: 'uuid',
|
|
709
|
+
tokens_table_id: 'uuid',
|
|
710
|
+
secrets_table_id: 'uuid',
|
|
711
|
+
addresses_table_id: 'uuid',
|
|
712
|
+
user_field: 'text',
|
|
713
|
+
crypto_network: 'text',
|
|
714
|
+
sign_in_request_challenge: 'text',
|
|
715
|
+
sign_in_record_failure: 'text',
|
|
716
|
+
sign_up_with_key: 'text',
|
|
717
|
+
sign_in_with_challenge: 'text'
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
field_module: {
|
|
721
|
+
schema: 'metaschema_modules_public',
|
|
722
|
+
table: 'field_module',
|
|
723
|
+
fields: {
|
|
724
|
+
id: 'uuid',
|
|
725
|
+
database_id: 'uuid',
|
|
726
|
+
private_schema_id: 'uuid',
|
|
727
|
+
table_id: 'uuid',
|
|
728
|
+
field_id: 'uuid',
|
|
729
|
+
data: 'jsonb',
|
|
730
|
+
triggers: 'text[]',
|
|
731
|
+
functions: 'text[]'
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
uuid_module: {
|
|
735
|
+
schema: 'metaschema_modules_public',
|
|
736
|
+
table: 'uuid_module',
|
|
737
|
+
fields: {
|
|
738
|
+
id: 'uuid',
|
|
739
|
+
database_id: 'uuid',
|
|
740
|
+
schema_id: 'uuid',
|
|
741
|
+
uuid_function: 'text',
|
|
742
|
+
uuid_seed: 'text'
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
default_ids_module: {
|
|
746
|
+
schema: 'metaschema_modules_public',
|
|
747
|
+
table: 'default_ids_module',
|
|
748
|
+
fields: {
|
|
749
|
+
id: 'uuid',
|
|
750
|
+
database_id: 'uuid'
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
denormalized_table_field: {
|
|
754
|
+
schema: 'metaschema_modules_public',
|
|
755
|
+
table: 'denormalized_table_field',
|
|
756
|
+
fields: {
|
|
757
|
+
id: 'uuid',
|
|
758
|
+
database_id: 'uuid',
|
|
759
|
+
table_id: 'uuid',
|
|
760
|
+
field_id: 'uuid',
|
|
761
|
+
set_ids: 'uuid[]',
|
|
762
|
+
ref_table_id: 'uuid',
|
|
763
|
+
ref_field_id: 'uuid',
|
|
764
|
+
ref_ids: 'uuid[]',
|
|
765
|
+
use_updates: 'boolean',
|
|
766
|
+
update_defaults: 'boolean',
|
|
767
|
+
func_name: 'text',
|
|
768
|
+
func_order: 'int'
|
|
769
|
+
}
|
|
206
770
|
}
|
|
207
771
|
};
|
|
208
772
|
export const exportMeta = async ({ opts, dbname, database_id }) => {
|
|
@@ -216,29 +780,84 @@ export const exportMeta = async ({ opts, dbname, database_id }) => {
|
|
|
216
780
|
return m;
|
|
217
781
|
}, {});
|
|
218
782
|
const queryAndParse = async (key, query) => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
783
|
+
try {
|
|
784
|
+
const result = await pool.query(query, [database_id]);
|
|
785
|
+
if (result.rows.length) {
|
|
786
|
+
const parsed = await parsers[key].parse(result.rows);
|
|
787
|
+
if (parsed) {
|
|
788
|
+
sql[key] = parsed;
|
|
789
|
+
}
|
|
224
790
|
}
|
|
225
791
|
}
|
|
792
|
+
catch (err) {
|
|
793
|
+
const pgError = err;
|
|
794
|
+
if (pgError.code === '42P01') {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
throw err;
|
|
798
|
+
}
|
|
226
799
|
};
|
|
800
|
+
// =============================================================================
|
|
801
|
+
// metaschema_public tables
|
|
802
|
+
// =============================================================================
|
|
227
803
|
await queryAndParse('database', `SELECT * FROM metaschema_public.database WHERE id = $1`);
|
|
804
|
+
await queryAndParse('database_extension', `SELECT * FROM metaschema_public.database_extension WHERE database_id = $1`);
|
|
228
805
|
await queryAndParse('schema', `SELECT * FROM metaschema_public.schema WHERE database_id = $1`);
|
|
229
806
|
await queryAndParse('table', `SELECT * FROM metaschema_public.table WHERE database_id = $1`);
|
|
230
807
|
await queryAndParse('field', `SELECT * FROM metaschema_public.field WHERE database_id = $1`);
|
|
808
|
+
await queryAndParse('policy', `SELECT * FROM metaschema_public.policy WHERE database_id = $1`);
|
|
809
|
+
await queryAndParse('index', `SELECT * FROM metaschema_public.index WHERE database_id = $1`);
|
|
810
|
+
await queryAndParse('trigger', `SELECT * FROM metaschema_public.trigger WHERE database_id = $1`);
|
|
811
|
+
await queryAndParse('trigger_function', `SELECT * FROM metaschema_public.trigger_function WHERE database_id = $1`);
|
|
812
|
+
await queryAndParse('rls_function', `SELECT * FROM metaschema_public.rls_function WHERE database_id = $1`);
|
|
813
|
+
await queryAndParse('limit_function', `SELECT * FROM metaschema_public.limit_function WHERE database_id = $1`);
|
|
814
|
+
await queryAndParse('procedure', `SELECT * FROM metaschema_public.procedure WHERE database_id = $1`);
|
|
815
|
+
await queryAndParse('foreign_key_constraint', `SELECT * FROM metaschema_public.foreign_key_constraint WHERE database_id = $1`);
|
|
816
|
+
await queryAndParse('primary_key_constraint', `SELECT * FROM metaschema_public.primary_key_constraint WHERE database_id = $1`);
|
|
817
|
+
await queryAndParse('unique_constraint', `SELECT * FROM metaschema_public.unique_constraint WHERE database_id = $1`);
|
|
818
|
+
await queryAndParse('check_constraint', `SELECT * FROM metaschema_public.check_constraint WHERE database_id = $1`);
|
|
819
|
+
await queryAndParse('full_text_search', `SELECT * FROM metaschema_public.full_text_search WHERE database_id = $1`);
|
|
820
|
+
await queryAndParse('schema_grant', `SELECT * FROM metaschema_public.schema_grant WHERE database_id = $1`);
|
|
821
|
+
await queryAndParse('table_grant', `SELECT * FROM metaschema_public.table_grant WHERE database_id = $1`);
|
|
822
|
+
await queryAndParse('extension', `SELECT * FROM metaschema_public.extension`);
|
|
823
|
+
// =============================================================================
|
|
824
|
+
// services_public tables
|
|
825
|
+
// =============================================================================
|
|
231
826
|
await queryAndParse('domains', `SELECT * FROM services_public.domains WHERE database_id = $1`);
|
|
232
|
-
await queryAndParse('apis', `SELECT * FROM services_public.apis WHERE database_id = $1`);
|
|
233
827
|
await queryAndParse('sites', `SELECT * FROM services_public.sites WHERE database_id = $1`);
|
|
234
|
-
await queryAndParse('
|
|
828
|
+
await queryAndParse('apis', `SELECT * FROM services_public.apis WHERE database_id = $1`);
|
|
829
|
+
await queryAndParse('apps', `SELECT * FROM services_public.apps WHERE database_id = $1`);
|
|
235
830
|
await queryAndParse('site_modules', `SELECT * FROM services_public.site_modules WHERE database_id = $1`);
|
|
236
831
|
await queryAndParse('site_themes', `SELECT * FROM services_public.site_themes WHERE database_id = $1`);
|
|
237
|
-
await queryAndParse('
|
|
238
|
-
await queryAndParse('
|
|
832
|
+
await queryAndParse('site_metadata', `SELECT * FROM services_public.site_metadata WHERE database_id = $1`);
|
|
833
|
+
await queryAndParse('api_modules', `SELECT * FROM services_public.api_modules WHERE database_id = $1`);
|
|
239
834
|
await queryAndParse('api_extensions', `SELECT * FROM services_public.api_extensions WHERE database_id = $1`);
|
|
240
835
|
await queryAndParse('api_schemata', `SELECT * FROM services_public.api_schemata WHERE database_id = $1`);
|
|
836
|
+
// =============================================================================
|
|
837
|
+
// metaschema_modules_public tables
|
|
838
|
+
// =============================================================================
|
|
241
839
|
await queryAndParse('rls_module', `SELECT * FROM metaschema_modules_public.rls_module WHERE database_id = $1`);
|
|
242
840
|
await queryAndParse('user_auth_module', `SELECT * FROM metaschema_modules_public.user_auth_module WHERE database_id = $1`);
|
|
841
|
+
await queryAndParse('memberships_module', `SELECT * FROM metaschema_modules_public.memberships_module WHERE database_id = $1`);
|
|
842
|
+
await queryAndParse('permissions_module', `SELECT * FROM metaschema_modules_public.permissions_module WHERE database_id = $1`);
|
|
843
|
+
await queryAndParse('limits_module', `SELECT * FROM metaschema_modules_public.limits_module WHERE database_id = $1`);
|
|
844
|
+
await queryAndParse('levels_module', `SELECT * FROM metaschema_modules_public.levels_module WHERE database_id = $1`);
|
|
845
|
+
await queryAndParse('users_module', `SELECT * FROM metaschema_modules_public.users_module WHERE database_id = $1`);
|
|
846
|
+
await queryAndParse('hierarchy_module', `SELECT * FROM metaschema_modules_public.hierarchy_module WHERE database_id = $1`);
|
|
847
|
+
await queryAndParse('membership_types_module', `SELECT * FROM metaschema_modules_public.membership_types_module WHERE database_id = $1`);
|
|
848
|
+
await queryAndParse('invites_module', `SELECT * FROM metaschema_modules_public.invites_module WHERE database_id = $1`);
|
|
849
|
+
await queryAndParse('emails_module', `SELECT * FROM metaschema_modules_public.emails_module WHERE database_id = $1`);
|
|
850
|
+
await queryAndParse('tokens_module', `SELECT * FROM metaschema_modules_public.tokens_module WHERE database_id = $1`);
|
|
851
|
+
await queryAndParse('secrets_module', `SELECT * FROM metaschema_modules_public.secrets_module WHERE database_id = $1`);
|
|
852
|
+
await queryAndParse('profiles_module', `SELECT * FROM metaschema_modules_public.profiles_module WHERE database_id = $1`);
|
|
853
|
+
await queryAndParse('encrypted_secrets_module', `SELECT * FROM metaschema_modules_public.encrypted_secrets_module WHERE database_id = $1`);
|
|
854
|
+
await queryAndParse('connected_accounts_module', `SELECT * FROM metaschema_modules_public.connected_accounts_module WHERE database_id = $1`);
|
|
855
|
+
await queryAndParse('phone_numbers_module', `SELECT * FROM metaschema_modules_public.phone_numbers_module WHERE database_id = $1`);
|
|
856
|
+
await queryAndParse('crypto_addresses_module', `SELECT * FROM metaschema_modules_public.crypto_addresses_module WHERE database_id = $1`);
|
|
857
|
+
await queryAndParse('crypto_auth_module', `SELECT * FROM metaschema_modules_public.crypto_auth_module WHERE database_id = $1`);
|
|
858
|
+
await queryAndParse('field_module', `SELECT * FROM metaschema_modules_public.field_module WHERE database_id = $1`);
|
|
859
|
+
await queryAndParse('uuid_module', `SELECT * FROM metaschema_modules_public.uuid_module WHERE database_id = $1`);
|
|
860
|
+
await queryAndParse('default_ids_module', `SELECT * FROM metaschema_modules_public.default_ids_module WHERE database_id = $1`);
|
|
861
|
+
await queryAndParse('denormalized_table_field', `SELECT * FROM metaschema_modules_public.denormalized_table_field WHERE database_id = $1`);
|
|
243
862
|
return Object.entries(sql).reduce((m, [_, v]) => m + '\n\n' + v, '');
|
|
244
863
|
};
|