Skip to content

Commit 15860ff

Browse files
authored
Merge pull request #1083 from constructive-io/feat/export-settings-tables
feat(export): add 6 new services_public settings tables to export
2 parents 6080749 + 7d7b759 commit 15860ff

3 files changed

Lines changed: 121 additions & 1 deletion

File tree

pgpm/export/src/export-graphql-meta.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ export const exportGraphQLMeta = async ({
152152
queryAndParse('site_metadata'),
153153
queryAndParse('api_modules'),
154154
queryAndParse('api_extensions'),
155-
queryAndParse('api_schemas')
155+
queryAndParse('api_schemas'),
156+
queryAndParse('database_settings'),
157+
queryAndParse('api_settings'),
158+
queryAndParse('rls_settings'),
159+
queryAndParse('cors_settings'),
160+
queryAndParse('pubkey_settings'),
161+
queryAndParse('webauthn_settings')
156162
]);
157163

158164
// metaschema_modules_public tables

pgpm/export/src/export-meta.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ export const exportMeta = async ({ opts, dbname, database_id }: ExportMetaParams
161161
await queryAndParse('api_modules', `SELECT * FROM services_public.api_modules WHERE database_id = $1 ORDER BY id`);
162162
await queryAndParse('api_extensions', `SELECT * FROM services_public.api_extensions WHERE database_id = $1 ORDER BY id`);
163163
await queryAndParse('api_schemas', `SELECT * FROM services_public.api_schemas WHERE database_id = $1 ORDER BY id`);
164+
await queryAndParse('database_settings', `SELECT * FROM services_public.database_settings WHERE database_id = $1 ORDER BY id`);
165+
await queryAndParse('api_settings', `SELECT * FROM services_public.api_settings WHERE database_id = $1 ORDER BY id`);
166+
await queryAndParse('rls_settings', `SELECT * FROM services_public.rls_settings WHERE database_id = $1 ORDER BY id`);
167+
await queryAndParse('cors_settings', `SELECT * FROM services_public.cors_settings WHERE database_id = $1 ORDER BY id`);
168+
await queryAndParse('pubkey_settings', `SELECT * FROM services_public.pubkey_settings WHERE database_id = $1 ORDER BY id`);
169+
await queryAndParse('webauthn_settings', `SELECT * FROM services_public.webauthn_settings WHERE database_id = $1 ORDER BY id`);
164170

165171
// =============================================================================
166172
// metaschema_modules_public tables

pgpm/export/src/export-utils.ts

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ export const META_TABLE_ORDER = [
149149
'api_modules',
150150
'api_extensions',
151151
'api_schemas',
152+
'database_settings',
153+
'api_settings',
154+
'rls_settings',
155+
'cors_settings',
156+
'pubkey_settings',
157+
'webauthn_settings',
152158
'rls_module',
153159
'user_auth_module',
154160
'memberships_module',
@@ -559,6 +565,108 @@ export const META_TABLE_CONFIG: Record<string, TableConfig> = {
559565
api_id: 'uuid'
560566
}
561567
},
568+
database_settings: {
569+
schema: 'services_public',
570+
table: 'database_settings',
571+
fields: {
572+
id: 'uuid',
573+
database_id: 'uuid',
574+
enable_aggregates: 'boolean',
575+
enable_postgis: 'boolean',
576+
enable_search: 'boolean',
577+
enable_direct_uploads: 'boolean',
578+
enable_presigned_uploads: 'boolean',
579+
enable_many_to_many: 'boolean',
580+
enable_connection_filter: 'boolean',
581+
enable_ltree: 'boolean',
582+
enable_llm: 'boolean',
583+
options: 'jsonb'
584+
}
585+
},
586+
api_settings: {
587+
schema: 'services_public',
588+
table: 'api_settings',
589+
fields: {
590+
id: 'uuid',
591+
database_id: 'uuid',
592+
api_id: 'uuid',
593+
enable_aggregates: 'boolean',
594+
enable_postgis: 'boolean',
595+
enable_search: 'boolean',
596+
enable_direct_uploads: 'boolean',
597+
enable_presigned_uploads: 'boolean',
598+
enable_many_to_many: 'boolean',
599+
enable_connection_filter: 'boolean',
600+
enable_ltree: 'boolean',
601+
enable_llm: 'boolean',
602+
options: 'jsonb'
603+
}
604+
},
605+
rls_settings: {
606+
schema: 'services_public',
607+
table: 'rls_settings',
608+
fields: {
609+
id: 'uuid',
610+
database_id: 'uuid',
611+
authenticate_schema_id: 'uuid',
612+
role_schema_id: 'uuid',
613+
authenticate_function_id: 'uuid',
614+
authenticate_strict_function_id: 'uuid',
615+
current_role_function_id: 'uuid',
616+
current_role_id_function_id: 'uuid',
617+
current_user_agent_function_id: 'uuid',
618+
current_ip_address_function_id: 'uuid'
619+
}
620+
},
621+
cors_settings: {
622+
schema: 'services_public',
623+
table: 'cors_settings',
624+
fields: {
625+
id: 'uuid',
626+
database_id: 'uuid',
627+
api_id: 'uuid',
628+
allowed_origins: 'text[]'
629+
}
630+
},
631+
pubkey_settings: {
632+
schema: 'services_public',
633+
table: 'pubkey_settings',
634+
fields: {
635+
id: 'uuid',
636+
database_id: 'uuid',
637+
schema_id: 'uuid',
638+
crypto_network: 'text',
639+
user_field: 'text',
640+
sign_up_with_key_function_id: 'uuid',
641+
sign_in_request_challenge_function_id: 'uuid',
642+
sign_in_record_failure_function_id: 'uuid',
643+
sign_in_with_challenge_function_id: 'uuid'
644+
}
645+
},
646+
webauthn_settings: {
647+
schema: 'services_public',
648+
table: 'webauthn_settings',
649+
fields: {
650+
id: 'uuid',
651+
database_id: 'uuid',
652+
schema_id: 'uuid',
653+
credentials_schema_id: 'uuid',
654+
sessions_schema_id: 'uuid',
655+
session_secrets_schema_id: 'uuid',
656+
credentials_table_id: 'uuid',
657+
sessions_table_id: 'uuid',
658+
session_credentials_table_id: 'uuid',
659+
session_secrets_table_id: 'uuid',
660+
user_field_id: 'uuid',
661+
rp_id: 'text',
662+
rp_name: 'text',
663+
origin_allowlist: 'text[]',
664+
attestation_type: 'text',
665+
require_user_verification: 'boolean',
666+
resident_key: 'text',
667+
challenge_expiry_seconds: 'int'
668+
}
669+
},
562670
// =============================================================================
563671
// metaschema_modules_public tables
564672
// =============================================================================

0 commit comments

Comments
 (0)