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