Add API to opt out of case conversion#4364
Open
clockwork-labs-bot wants to merge 1 commit intoshub/case-conversionfrom
Open
Add API to opt out of case conversion#4364clockwork-labs-bot wants to merge 1 commit intoshub/case-conversionfrom
clockwork-labs-bot wants to merge 1 commit intoshub/case-conversionfrom
Conversation
4d2fe47 to
cd29e90
Compare
Add RawModuleDefV10Builder::set_case_conversion_policy() and an internal register_case_conversion_policy() function in rt.rs. This allows modules like controldb to disable case conversion via a __preinit__ hook, avoiding migration errors when existing data uses a different naming convention. Re-exports CaseConversionPolicy from the bindings crate for convenience.
cd29e90 to
c01bd7a
Compare
Contributor
|
We have tested this in staging |
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.
Companion to the case conversion PR (#4263).
Adds an API for existing modules to disable automatic case conversion, preventing migration errors from renamed fields or enum variants when deploying the case conversion feature against modules with existing data.
Changes:
RawModuleDefV10Builder::set_case_conversion_policy(policy)— sets the module-level case conversion policyspacetimedb::rt::register_no_case_conversion()— convenience function for modules to disable case conversionUsage in a module:
This is needed for the controldb module which has existing data with PascalCase enum variants (
Owner,Admin, etc.) that would be renamed to camelCase (owner,admin, etc.) by the default SnakeCase policy.