Auto-include partition columns in unique indexes (GH-3557)#4139
Merged
jeremydmiller merged 1 commit intomasterfrom Feb 16, 2026
Merged
Auto-include partition columns in unique indexes (GH-3557)#4139jeremydmiller merged 1 commit intomasterfrom
jeremydmiller merged 1 commit intomasterfrom
Conversation
Use Weasel project reference with fix that auto-includes partition columns in unique index DDL. Add tests verifying partition columns are included for multi-tenant and soft-delete partitioning, no duplication when already present, and successful schema application to PostgreSQL. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 17, 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
IndexDefinition.correctedExpression()to automatically append any missing partition columns when generating DDL for unique indexes on partitioned tablesWeasel Change
The core fix is in Weasel's
IndexDefinition.cs(correctedExpression(Table? parent)). WhenIsUniqueand the parent table has aPartitioningstrategy, any partition columns not already present in the index'sColumnsare appended to the index expression. The Weasel commit is on branchGH3557-unique-index-partitioningat~/code/weasel.Tests Added
unique_index_on_partitioned_table_includes_partition_columns_in_ddl- DDL includestenant_idfor hash-partitioned tableunique_index_on_soft_delete_partitioned_table_includes_partition_columns_in_ddl- DDL includesmt_deletedfor soft-delete partitioned tableunique_index_does_not_duplicate_partition_columns_already_present- No duplication when partition column already in index viaTenancyScope.PerTenantunique_index_on_partitioned_table_can_be_applied_to_database- Integration test applying schema to PostgreSQLTest plan
🤖 Generated with Claude Code