Skip to content

backport(1.11): drop the model's outbound foreign keys too (#632) - #794

Open
axellpadilla wants to merge 2 commits into
backport/1.11-transaction-fixesfrom
backport/1.11-632-outbound-fk
Open

backport(1.11): drop the model's outbound foreign keys too (#632)#794
axellpadilla wants to merge 2 commits into
backport/1.11-transaction-fixesfrom
backport/1.11-632-outbound-fk

Conversation

@axellpadilla

Copy link
Copy Markdown
Collaborator

Backport of #793 to release/v1.11.

drop_fk_constraints() only matched foreign keys whose referenced table was the model, so the keys the table itself declares survived the macro and kept blocking a truncate or rebuild of the table they point at. The join now also matches parent_object_id, still scoped to the model's own schema.

The fix commit cherry-picks clean from master (6d7d5aa), with the changelog kept as a separate commit. Stacked on #791 rather than release/v1.11 directly, because the (nolock) hints on this same join arrive with #791 — retarget once that merges.

test_index_macros.py passes on this branch (3/3), including the new both-directions assertion.

drop_fk_constraints() only matched foreign keys whose referenced table
was the model, so the keys the table itself declares survived the macro
and kept blocking a truncate or rebuild of the table they point at. Join
on parent_object_id as well, still scoped to the model's own schema.

Consolidate the module's tests into a single project and dbt invocation,
adding fk_model to cover both directions.

No CHANGELOG change, so this cherry-picks clean onto release/v1.11.
@axellpadilla axellpadilla added this to the v1.11.0 milestone Aug 1, 2026
axellpadilla added a commit that referenced this pull request Aug 1, 2026
Both workflows filtered on `branches: [master, v*]`. GitHub matches the
whole ref, so `v*` matches a branch literally named `v1.11` but not
`release/v1.11` — the naming this repo actually uses. Pull requests
targeting a release branch therefore ran pre-commit only: no unit tests
and no integration matrix.

That left backports as the least-tested changes in the repo, despite
shipping first. #791 and #794 currently have no test coverage at all.

Adding `release/**` to the push and pull_request filters of both
workflows. Stacked pull requests (base is a feature branch rather than
master or a release branch) are still uncovered by design; those are
validated once rebased, or by dispatching the workflow against the
branch.
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