Consolidate functionality for building column definition schemas.

Review Request #12224 — Created April 5, 2022 and submitted — Latest diff uploaded

Information

Django Evolution
release-2.x

Reviewers

This introduces BaseEvolutionOperations.build_column_schema(), which
will compute pieces of SQL needed in order to create or re-create a
column.

This sort of operation has been implemented in a few different spots in
the codebase, in a few different ways. This consolidates all these,
simplifying the code paths, easing maintainability, and setting things
up for an upcoming change for field type changes.

There is one change to the generation that impacts the SQLite3 tests,
but not any actual operation. The old logic would generate a UNIQUE
for a PRIMARY KEY, which wasn't at all necessary. The new logic avoids
that.

Unit tests pass for all versions of Django and all databases.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Consolidate functionality for building column definition schemas.
This introduces `BaseEvolutionOperations.build_column_schema()`, which will compute pieces of SQL needed in order to create or re-create a column. This sort of operation has been implemented in a few different spots in the codebase, in a few different ways. This consolidates all these, simplifying the code paths, easing maintainability, and setting things up for an upcoming change for field type changes. There is one change to the generation that impacts the SQLite3 tests, but not any actual operation. The old logic would generate a `UNIQUE` for a `PRIMARY KEY`, which wasn't at all necessary. The new logic avoids that.
1db924d4acf44f0f580fd36d311475e73b647ce7 Christian Hammond
django_evolution/db/common.py
django_evolution/db/mysql.py
django_evolution/db/sqlite3.py
django_evolution/tests/db/mysql.py
django_evolution/tests/db/sqlite3.py
Loading...