Backend specific migration fixes#2109
Merged
Merged
Conversation
Pull Request Test Coverage Report for Build 22035846783Details
💛 - Coveralls |
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.
Resolved #2108 and some other backend specific issues
AI summary:
This pull request introduces several improvements and new features to the migrations and schema editing system, with a focus on enhanced cross-database compatibility, new constraint management, and improved test coverage. The most significant changes include the addition of a dialect-aware random hex default generator, support for named unique constraints in migrations, enhancements to schema editors for MySQL and MSSQL, and comprehensive tests for unique constraint handling.
Major Features and Enhancements
RandomHexdialect-awareSqlDefaultsubclass to generate random hex strings as default values across all supported backends, replacing backend-specific SQL expressions. (RandomHex) is now used in both models and migrations for fields liketracking_id. [1] [2] [3] [4] [5]Meta.constraintson models, enabling namedUniqueConstraintobjects to be captured by the migration autodetector. This allows for automatic generation ofAddConstraintandRemoveConstraintoperations in migrations. [1] [2] [3]Schema Editor and Backend Improvements
_alter_fieldnow usesMODIFY COLUMNfor NULL/NOT NULL changes and backtick-quoted templates._alter_fieldusesALTER COLUMNfor nullability, manages named default constraints, uses bracket-quoted templates, and downgrades self-referencing FK CASCADE to NO ACTION.Migration and Model Changes
RunSQLtoRunPythonfor better backend compatibility. [1] [2] [3]Testing Improvements
CREATE TABLEstatements.Documentation
CHANGELOG.rstto document all new features, backend improvements, and bug fixes included in this release.