@@ -546,7 +546,7 @@ fn auto_migrate_view<'def>(plan: &mut AutoMigratePlan<'def>, old: &'def ViewDef,
546546 // 2. If we change the order of the columns or parameters
547547 // 3. If we change the types of the columns or parameters
548548 // 4. If we change the context parameter
549- let Any ( incompatible_return_type ) = diff ( plan. old , plan. new , |def| {
549+ let Any ( _incompatible_return_type ) = diff ( plan. old , plan. new , |def| {
550550 def. lookup_expect :: < ViewDef > ( key) . return_columns . iter ( )
551551 } )
552552 . map ( |col_diff| {
@@ -575,7 +575,7 @@ fn auto_migrate_view<'def>(plan: &mut AutoMigratePlan<'def>, old: &'def ViewDef,
575575 } )
576576 . collect ( ) ;
577577
578- let Any ( incompatible_param_types ) = diff ( plan. old , plan. new , |def| {
578+ let Any ( _incompatible_param_types ) = diff ( plan. old , plan. new , |def| {
579579 def. lookup_expect :: < ViewDef > ( key) . param_columns . iter ( )
580580 } )
581581 . map ( |col_diff| {
@@ -604,15 +604,24 @@ fn auto_migrate_view<'def>(plan: &mut AutoMigratePlan<'def>, old: &'def ViewDef,
604604 } )
605605 . collect ( ) ;
606606
607- if old. is_anonymous != new. is_anonymous || incompatible_return_type || incompatible_param_types {
608- plan. steps . push ( AutoMigrateStep :: AddView ( new. key ( ) ) ) ;
609- plan. steps . push ( AutoMigrateStep :: RemoveView ( old. key ( ) ) ) ;
610-
611- if !plan. disconnects_all_users ( ) {
612- plan. steps . push ( AutoMigrateStep :: DisconnectAllUsers ) ;
613- }
614- } else {
615- plan. steps . push ( AutoMigrateStep :: UpdateView ( old. key ( ) ) ) ;
607+ // TODO: Uncomment and re-enable view auto-migrations without disconnecting clients
608+ //
609+ // if old.is_anonymous != new.is_anonymous || incompatible_return_type || incompatible_param_types {
610+ // plan.steps.push(AutoMigrateStep::AddView(new.key()));
611+ // plan.steps.push(AutoMigrateStep::RemoveView(old.key()));
612+
613+ // if !plan.disconnects_all_users() {
614+ // plan.steps.push(AutoMigrateStep::DisconnectAllUsers);
615+ // }
616+ // } else {
617+ // plan.steps.push(AutoMigrateStep::UpdateView(old.key()));
618+ // }
619+
620+ plan. steps . push ( AutoMigrateStep :: AddView ( new. key ( ) ) ) ;
621+ plan. steps . push ( AutoMigrateStep :: RemoveView ( old. key ( ) ) ) ;
622+
623+ if !plan. disconnects_all_users ( ) {
624+ plan. steps . push ( AutoMigrateStep :: DisconnectAllUsers ) ;
616625 }
617626
618627 Ok ( ( ) )
@@ -1904,18 +1913,31 @@ mod tests {
19041913 let plan = ponder_auto_migrate ( & old_def, & new_def) . expect ( "auto migration should succeed" ) ;
19051914 let steps = & plan. steps [ ..] ;
19061915
1907- assert ! ( !plan. disconnects_all_users( ) , "{name}, plan: {plan:#?}" ) ;
1916+ // TODO: Assert that we don't disconnect users once we have automatic view update in auto-migrations
1917+ //
1918+ // assert!(!plan.disconnects_all_users(), "{name}, plan: {plan:#?}");
1919+
1920+ // assert!(
1921+ // steps.contains(&AutoMigrateStep::UpdateView(&my_view)),
1922+ // "{name}, steps: {steps:?}"
1923+ // );
1924+ // assert!(
1925+ // !steps.contains(&AutoMigrateStep::AddView(&my_view)),
1926+ // "{name}, steps: {steps:?}"
1927+ // );
1928+ // assert!(
1929+ // !steps.contains(&AutoMigrateStep::RemoveView(&my_view)),
1930+ // "{name}, steps: {steps:?}"
1931+ // );
1932+
1933+ assert ! ( plan. disconnects_all_users( ) , "{name}, plan: {plan:#?}" ) ;
19081934
19091935 assert ! (
1910- steps. contains( & AutoMigrateStep :: UpdateView ( & my_view) ) ,
1911- "{name}, steps: {steps:?}"
1912- ) ;
1913- assert ! (
1914- !steps. contains( & AutoMigrateStep :: AddView ( & my_view) ) ,
1936+ steps. contains( & AutoMigrateStep :: AddView ( & my_view) ) ,
19151937 "{name}, steps: {steps:?}"
19161938 ) ;
19171939 assert ! (
1918- ! steps. contains( & AutoMigrateStep :: RemoveView ( & my_view) ) ,
1940+ steps. contains( & AutoMigrateStep :: RemoveView ( & my_view) ) ,
19191941 "{name}, steps: {steps:?}"
19201942 ) ;
19211943 }
0 commit comments