Currently, any using value passed to alter_column_type is overwritten by the following logic:
if using is not None:
using = f"{column_name}::{using}"
if new_type != "bool":
using = f"{column_name}::{new_type}"
else:
using = f"CASE WHEN {column_name}::int=0 THEN FALSE WHEN {column_name} IS NULL THEN NULL ELSE TRUE END"
Either new_type is "bool" or not, and in either case, any original value ends up being replaced.
This PR corrects the issue by replacing if new_type != "bool" to elif new_type != "bool".
Currently, any
using
value passed toalter_column_type
is overwritten by the following logic:Either
new_type
is "bool" or not, and in either case, any original value ends up being replaced.This PR corrects the issue by replacing
if new_type != "bool"
toelif new_type != "bool"
.