Add field type change support in each database backend.
Review Request #12233 — Created April 8, 2022 and submitted
This updates the MySQL, Postgres, and SQLite database backends to
support changing the types of a field.Both MySQL and Postgres build upon the common code, building SQL for
altering the field type, and letting the common code handle constraint
management. This is more complicated in the case of Postgres, where we
also need to backup/restore theAUTO INCREMENT
state, and need to
cast field types. MySQL does not appear to require either of these
operations.The SQLite support, as per usual, requires a full table rebuild in order
to change columns. This completely overrides the common code, going
through our standard table rebuild logic. There isn't much that's needed
here, since we already have machinery set up for determining how to
replace an existing field, and the type isn't really special in this
regard. The only addition to the logic is a newCHANGE COLUMN TYPE
operator that's passed in order to set the right field state.Upcoming changes will introduce
ChangeField
support for invoking this
behavior, along with unit tests.
Unit tests pass when used with the other in-progress changes.
Summary | ID |
---|---|
19f8f4c9b437df4f23a0b3706c865f8086bd8be0 |
Description | From | Last Updated |
---|---|---|
F841 local variable 'alter_table_items' is assigned to but never used |
reviewbot |