Consolidate functionality for building column definition schemas.

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

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.

Summary ID
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
Description From Last Updated

F841 local variable 'sql_result' is assigned to but never used

reviewbotreviewbot

F841 local variable 'table_name' is assigned to but never used

reviewbotreviewbot

F821 undefined name 'new_field'

reviewbotreviewbot

F821 undefined name 'new_field'

reviewbotreviewbot

F841 local variable 'remote_field' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.x (f14c85c)
Loading...