Skip to content

fix: remove PostgreSQL routines when resetting schema - #336

Merged
elpete merged 1 commit into
nextfrom
fix/postgres-reset-routines
Oct 4, 2026
Merged

elpete merged 1 commit into
nextfrom
fix/postgres-reset-routines

Conversation

@elpete

@elpete elpete commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

PostgreSQL dropAllObjects() currently drops tables but leaves application functions behind. CommandBox Migrations' migrate fresh then fails when replaying migrations with CREATE FUNCTION because those functions already exist.

This change also drops functions and procedures in the requested schema, including when no tables remain. Extension-owned routines are excluded. Qualified catalog argument types identify overloads without depending on search_path and avoid JDBC parsing issues with timestamp with time zone signatures. IF EXISTS handles routines already removed by cascading table drops.

Validation:

  • 151 focused PostgreSQL schema TestBox checks passed, with zero failures or errors.
  • Real PostgreSQL regression covers overloads, quoted names, procedures, timestamp arguments, table-dependent functions, routine-only resets, extension preservation, and another schema remaining intact. This spec is opt-in via QB_POSTGRES_RESET_TEST=true and requires a disposable PostgreSQL datasource without pgcrypto already installed; its changes roll back.
  • Verified CommuniArts' complete migration sequence, followed by migrate fresh and IntoTheWoodsDemoSeeder, in a disposable database. Cleanup passed.
  • Targeted CFFormat and git diff --check passed. Full engine/database matrices have not been run locally.

@elpete
elpete merged commit a14461e into next Oct 4, 2026
35 checks passed
@elpete
elpete deleted the fix/postgres-reset-routines branch October 4, 2026 08:59
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