Skip to content

feat(export): explicit excludeCategories filtering in exportMigrations#1399

Open
pyramation wants to merge 2 commits into
mainfrom
feat/export-exclude-categories
Open

feat(export): explicit excludeCategories filtering in exportMigrations#1399
pyramation wants to merge 2 commits into
mainfrom
feat/export-exclude-categories

Conversation

@pyramation

@pyramation pyramation commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes excludeCategories a real, first-class export filter in both export modes, replacing the inert cross-connection export.exclude_categories GUC approach.

SQL mode (exportMigrations / exportMigrationsToDisk): new excludeCategories?: string[] option filters directly in the exporter query (parameterized, null-preserving, deterministic):

select * from db_migrate.sql_actions
where database_id = $1
  and (category is null or category != ALL($2::text[]))
order by id

Also removes an incorrect pgPool.end() on the cached pool from getPgPool().

GraphQL mode (exportGraphQL): the migrate-client schema/ORM previously didn't expose category at all, so the GraphQL path couldn't filter. This PR:

  • adds category to sdk/migrate-client/schemas/migrate.graphql (SqlAction, SqlActionFilter, SqlActionOrderBy) and regenerates the ORM client
  • selects category and filters server-side in the sqlAction.findMany where-clause:
where: {
  databaseId: { equalTo: databaseId },
  or: [{ category: { isNull: true } }, { category: { notIn: excludeCategories } }]
}

CLI: pgpm export --exclude-categories security,permissions,auth,memberships now works in both SQL and GraphQL modes.

Behavior notes: omitted/empty excludeCategories preserves the original queries exactly; category IS NULL rows are always kept; ordering stays ID_ASC with existing pagination.

Testing

  • pgpm/export integration tests extended with a category='security' action: excluded from plan/deploy files when filtered, retained when not — 146 tests passing.
  • migrate-client, @pgpmjs/export, pgpm CLI build clean.

Link to Devin session: https://app.devin.ai/sessions/9ad75ab0ed7e412f9339213390ddf29a
Requested by: @pyramation

@pyramation pyramation self-assigned this Jul 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
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, CI, and merge conflict monitoring

Adds category to the migrate-client schema/ORM (SqlAction field, filter,
orderBy) and filters sql_actions server-side in exportGraphQL via
or: [category isNull, category notIn excludeCategories], keeping
null-category rows. CLI now passes --exclude-categories in both modes.
@devin-ai-integration
devin-ai-integration Bot force-pushed the feat/export-exclude-categories branch from 445e7a4 to 89fcfbd Compare July 21, 2026 00:40
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.

1 participant