Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Jan 8, 2026

Summary

Expands the export-meta.ts config to export ALL tables from three schemas when exporting constructive-services metadata via the introspection package. Previously, only a subset of tables were exported.

Added tables:

  • metaschema_public (15 new): policy, index, trigger, trigger_function, rls_function, limit_function, procedure, foreign_key_constraint, primary_key_constraint, unique_constraint, check_constraint, full_text_search, schema_grant, table_grant, extension
  • services_public (1 new): site_metadata
  • metaschema_modules_public (21 new): memberships_module, permissions_module, limits_module, levels_module, users_module, hierarchy_module, membership_types_module, invites_module, emails_module, tokens_module, secrets_module, profiles_module, encrypted_secrets_module, connected_accounts_module, phone_numbers_module, crypto_addresses_module, crypto_auth_module, field_module, uuid_module, default_ids_module, denormalized_table_field

New field types added: uuid[], int, interval, timestamptz

Updates since last revision

  • Added error handling in queryAndParse to gracefully skip tables that don't exist (catches PostgreSQL error code 42P01 = undefined_table). This allows the export to work with databases that don't have all metaschema tables deployed.

Review & Testing Checklist for Human

  • Verify field definitions match actual database schemas - Field definitions were derived from SQL CREATE TABLE statements in pgpm-modules/, but there may be mismatches or missing columns
  • Verify the csv-to-pg Parser supports the new field types (uuid[], int, interval, timestamptz) - if not, runtime errors will occur
  • Check if extension table query should filter by database_id - currently queries all extensions without WHERE clause (line 842)
  • Review silent error handling - Missing tables are now silently skipped; verify this is the desired behavior vs. logging a warning
  • Test end-to-end: Run generate:rls in the introspection package against a real database and verify the generated meta.sql contains INSERT statements for all new tables

Notes

  • Local pnpm build passed successfully
  • CI initially failed because test database didn't have metaschema_public.policy table; fixed by adding error handling to skip missing tables
  • Field definitions were derived by reading SQL CREATE TABLE statements in pgpm-modules/metaschema-modules/ and pgpm-modules/metaschema-schema/

Link to Devin run: https://app.devin.ai/sessions/5c1c71a0c3284e0883313ac30f889c9d
Requested by: Dan Lynch (@pyramation)

…, and metaschema_modules_public

Add all missing tables to the export-meta.ts config object to ensure
complete metadata export when exporting constructive-services via the
introspection package.

Added tables:
- metaschema_public: policy, index, trigger, trigger_function, rls_function,
  limit_function, procedure, foreign_key_constraint, primary_key_constraint,
  unique_constraint, check_constraint, full_text_search, schema_grant,
  table_grant, extension
- services_public: site_metadata
- metaschema_modules_public: memberships_module, permissions_module,
  limits_module, levels_module, users_module, hierarchy_module,
  membership_types_module, invites_module, emails_module, tokens_module,
  secrets_module, profiles_module, encrypted_secrets_module,
  connected_accounts_module, phone_numbers_module, crypto_addresses_module,
  crypto_auth_module, field_module, uuid_module, default_ids_module,
  denormalized_table_field

Also added new field types: uuid[], int, interval, timestamptz
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add try-catch to queryAndParse to skip tables that don't exist
(PostgreSQL error code 42P01 = undefined_table). This allows the
export to work with databases that don't have all metaschema tables
deployed.
@pyramation pyramation merged commit d5ad755 into main Jan 8, 2026
36 checks passed
@pyramation pyramation deleted the devin/1767852231-export-all-meta-tables branch January 8, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants