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 2 (Latest)

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.
3143193ab76c3b4e07badfc95320c1dcf18252ea 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...