Fix 4837 alter table alter column #4846
Merged
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.
fixes #4837
🚧 🐘 🍔 Working on fix
Allow AlterTableAlterColumnMixin extends SqlColumnDef to provide operations to
TableInterfaceGenerator
as it now becomes aColumnDefMixin
source - however it only seems viable for Column Type changesOverride
SqlColumnDef
members ( use thecolumn_type
declared in the ALTER TABLE or existing SqlColumnDef declared in CREATE TABLE ) to fall back to the current values if they are not being altered. Onlycolumn_type
andcolumn_name
can be used with SqlColumnDef. ColumnConstraints are not used to drop/set nullability (use query column nullable) as there is no matching clause in ALTER TABLE.FIXED - If a migration step 1 is
ALTER TABLE test ALTER COLUMN first DROP NOT NULL
and step 2 isALTER TABLE test ALTER COLUMN first TYPE BIGINT;
changing the type propagates the same NOT NULL/NULL - keep the current queryColumn.nullable value when not anull
value - means it was set in another migration and queryColumn propagates the correct nullabilitye.g
queryColumn.copy(element = alterColumnTable, nullable = nullableColumn ?: queryColumn.nullable)
🦺 Performed more testing of local snapshot with column type changes and nullability changes
1.sqm
2.sqm
3.sqm
4.sqm
5.sqm
results in