Support conjoined tenancy for DCB tags and natural keys#4206
Merged
jeremydmiller merged 1 commit intomasterfrom Mar 25, 2026
Merged
Support conjoined tenancy for DCB tags and natural keys#4206jeremydmiller merged 1 commit intomasterfrom
jeremydmiller merged 1 commit intomasterfrom
Conversation
Add tenant_id column to EventTagTable and NaturalKeyTable primary keys when using conjoined tenancy. Fix NaturalKeyTable foreign keys to mt_streams to include tenant_id (and is_archived when partitioned). Add tenant_id filtering to all DCB tag queries (QueryByTags, EventsExist, AssertDcbConsistency, FetchForWritingByTags) and tag insert operations. Update NaturalKeyProjection upsert ON CONFLICT clause and QuickAppendEventFunction tag inserts for tenant isolation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
This was referenced Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tenant_idcolumn toEventTagTableandNaturalKeyTableprimary keys when using conjoined tenancyNaturalKeyTableforeign keys tomt_streamsto includetenant_id(andis_archivedwhen partitioned), resolving the FK mismatch described in Generated DB patch scripts for natural key tables do not account for conjoined multitenancy #4201QueryByTags,EventsExist,AssertDcbConsistency,FetchForWritingByTags) for proper tenant isolationInsertEventTagOperation,InsertEventTagByEventIdOperation,AssignTagWhereOperation,QuickAppendEventFunction) to includetenant_idNaturalKeyProjectionupsertON CONFLICTclause to includetenant_idCloses #4201
Test plan
🤖 Generated with Claude Code