@@ -185,17 +185,14 @@ pub fn build_modify_column_type(
185185 // Determine if we need to create a new enum type
186186 // - If old type was a different enum, we need to create the new one
187187 // - If old type was not an enum, we need to create the enum type
188- let should_create = if let Some ( old_col_type) = old_type {
189- match old_col_type {
190- ColumnType :: Complex ( ComplexColumnType :: Enum { name : old_name, .. } ) => {
191- old_name != new_name
192- }
193- _ => true , // Old type wasn't an enum, need to create enum type
194- }
188+ let should_create = if let Some ( ColumnType :: Complex ( ComplexColumnType :: Enum {
189+ name : old_name,
190+ ..
191+ } ) ) = old_type
192+ {
193+ old_name != new_name
195194 } else {
196- // old_type is None - this means the column wasn't found in current schema
197- // This should not happen as we're modifying an existing column
198- // But we'll create the type to be safe
195+ // Either old_type is None or it wasn't an enum - need to create enum type
199196 true
200197 } ;
201198
@@ -339,10 +336,12 @@ mod tests {
339336 & [ ] ,
340337 ) ;
341338 assert ! ( result. is_err( ) ) ;
342- assert ! ( result
343- . unwrap_err( )
344- . to_string( )
345- . contains( "Table 'nonexistent_table' not found" ) ) ;
339+ assert ! (
340+ result
341+ . unwrap_err( )
342+ . to_string( )
343+ . contains( "Table 'nonexistent_table' not found" )
344+ ) ;
346345 }
347346
348347 #[ test]
@@ -371,10 +370,12 @@ mod tests {
371370 & current_schema,
372371 ) ;
373372 assert ! ( result. is_err( ) ) ;
374- assert ! ( result
375- . unwrap_err( )
376- . to_string( )
377- . contains( "Column 'nonexistent_column' not found" ) ) ;
373+ assert ! (
374+ result
375+ . unwrap_err( )
376+ . to_string( )
377+ . contains( "Column 'nonexistent_column' not found" )
378+ ) ;
378379 }
379380
380381 #[ rstest]
@@ -720,14 +721,9 @@ mod tests {
720721 indexes: vec![ ] ,
721722 } ] ;
722723
723- let result = build_modify_column_type (
724- & backend,
725- "users" ,
726- "status" ,
727- & new_type,
728- & current_schema,
729- )
730- . unwrap ( ) ;
724+ let result =
725+ build_modify_column_type ( & backend, "users" , "status" , & new_type, & current_schema)
726+ . unwrap ( ) ;
731727
732728 let sql = result
733729 . iter ( )
0 commit comments