Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Dec 25, 2025

Summary

Fixes two bugs in the pgpm export command's meta_public schema export:

  1. Table name typo: Changed database_extensions (plural) to database_extension (singular) in the config. The query was already using the correct singular form, but the config used plural, causing generated INSERT statements to target a non-existent table.

  2. Missing field query: The field table was defined in the config but never actually queried. Added the missing queryAndParse('field', ...) call.

Updates since last revision

  • Removed CLI integration test that was added earlier. The test exposed a pre-existing compatibility issue with the csv-to-pg library (ast.ResTarget is not a function). This is unrelated to the bug fixes in this PR.
  • The static config validation tests in pgpm/core/__tests__/export/ remain and verify the bug fixes.

Review & Testing Checklist for Human

  • Verify table name is correct: Confirm that collections_public.database_extension (singular) is the actual table name in db-meta-schema
  • Test export end-to-end: Run pgpm export against a database with db-meta-schema deployed and verify the generated SQL is valid
  • Decide on plan.md: The plan.md documents additional issues not addressed in this PR (missing columns in user_auth_module, missing site_metadata table). Decide if it should remain in the repo or be removed

Recommended test plan: Deploy db-meta-schema to a test database, seed some data, run pgpm export, and attempt to replay the generated SQL in a fresh database.

Notes

The tests in this PR are static config validation tests that read the source file and verify the config structure. They do not require a database connection. Full integration testing of exportMeta() is blocked by a pre-existing csv-to-pg compatibility issue that should be addressed separately.

Additional issues documented in plan.md that may need follow-up:

  • Missing columns in user_auth_module config
  • Missing site_metadata table
  • Type mismatches (attachment vs upload, hostname vs text, json vs jsonb)

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

devin-ai-integration bot and others added 2 commits December 25, 2025 01:02
- Fix table name from 'database_extensions' (plural) to 'database_extension' (singular)
- Add missing queryAndParse call for 'field' table in collections_public
- Add unit tests to validate export-meta config structure

Co-Authored-By: Dan Lynch <[email protected]>
@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

- Tests exportMeta function with proper table names
- Verifies database_extension (singular) is used correctly
- Tests that field table is queried
- Validates exported SQL contains expected data
The test exposed a pre-existing compatibility issue with csv-to-pg library
(ast.ResTarget is not a function). The static config validation tests in
pgpm/core/__tests__/export/ already verify the bug fixes.

This can be revisited once the csv-to-pg compatibility issue is resolved.
@pyramation pyramation closed this Dec 25, 2025
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