Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15396

revert_schema() steps not executed in correct order

XMLWordPrintable

      When deleting data of the attached extension, I'm getting this error:
       

      ContextErrorException in driver.php line 999

      User Error: SQL ERROR [ mysqli ]<br /><br />Table 'phpbb32.phpbb_test_table' doesn't exist [1146]<br /><br />SQL<br /><br />SHOW COLUMNS FROM phpbb_test_table

      in driver.php line 999

      1. at ErrorHandler->handleError('256', 'SQL ERROR [ mysqli ]<br /><br />Table 'phpbb32.phpbb_test_table' doesn't exist [1146]<br /><br />SQL<br /><br />SHOW COLUMNS FROM phpbb_test_table', '/vagrant/www/32/phpbb/db/driver/driver.php', '999', array('sql' => 'SHOW COLUMNS FROM phpbb_test_table', 'auth' => object(auth), 'user' => object(user), 'config' => object(db), 'message' => 'SQL ERROR [ mysqli ]<br /><br />Table 'phpbb32.phpbb_test_table' doesn't exist [1146]<br /><br />SQL<br /><br />SHOW COLUMNS FROM phpbb_test_table'), null) in error_handler.php line 29
      2. at error_handler->handleError('256', 'SQL ERROR [ mysqli ]<br /><br />Table 'phpbb32.phpbb_test_table' doesn't exist [1146]<br /><br />SQL<br /><br />SHOW COLUMNS FROM phpbb_test_table', '/vagrant/www/32/phpbb/db/driver/driver.php', '999', array('sql' => 'SHOW COLUMNS FROM phpbb_test_table', 'auth' => object(auth), 'user' => object(user), 'config' => object(db), 'message' => 'SQL ERROR [ mysqli ]<br /><br />Table 'phpbb32.phpbb_test_table' doesn't exist [1146]<br /><br />SQL<br /><br />SHOW COLUMNS FROM phpbb_test_table'))
      3. at trigger_error('SQL ERROR [ mysqli ]<br /><br />Table 'phpbb32.phpbb_test_table' doesn't exist [1146]<br /><br />SQL<br /><br />SHOW COLUMNS FROM phpbb_test_table', '256') in driver.php line 999
      4. at driver->sql_error('SHOW COLUMNS FROM phpbb_test_table') in mysqli.php line 193
      5. at mysqli->sql_query('SHOW COLUMNS FROM phpbb_test_table') in tools.php line 885
      6. at tools->sql_list_columns('phpbb_test_table') in tools.php line 902
      7. at tools->sql_column_exists('phpbb_test_table', 'some_number') in tools.php line 602
      8. at tools->perform_schema_changes(array('drop_columns' => array('phpbb_test_table' => array('some_number'))))
      9. at call_user_func_array(array(object(tools), 'perform_schema_changes'), array(array('drop_columns' => array('phpbb_test_table' => array('some_number'))))) in migrator.php line 711
      10. at migrator->run_step(array('dbtools.perform_schema_changes', array(array('drop_columns' => array('phpbb_test_table' => array('some_number'))))), null, false) in migrator.php line 658
      11. at migrator->process_data_step(array(array('dbtools.perform_schema_changes', array(array('add_columns' => array('phpbb_test_table' => array('some_numbr' => array('UINT', '0')))))), array('dbtools.perform_schema_changes', array(array('drop_columns' => array('phpbb_test_table' => array('some_number')))))), array('result' => null, 'step' => '1', '_total_time' => '0.0045359134674072')) in migrator.php line 586
      12. at migrator->try_revert('\kasimi\migrationtest\migrations\m2_schema_fix') in migrator.php line 514
      13. at migrator->revert_do('\kasimi\migrationtest\migrations\m2_schema_fix') in migrator.php line 488
      14. at migrator->revert('\kasimi\migrationtest\migrations\m2_schema_fix') in base.php line 108
      15. at base->purge_step(true) in manager.php line 359
      16. at manager->purge_step('kasimi/migrationtest') in acp_extensions.php line 304
      17. at acp_extensions->main('extensions', 'main') in functions_module.php line 676
      18. at p_master->load_active() in index.php line 82

       
      What happens in my deleting data tests is that from m2, the 'add_columns' is executed, but 'drop_columns' isn't. Then, m1's revert_schema is executed, deleting the table. Finally it goes back to m2 and tries to do the 'drop_column' on the table that doesn't exist any more.

      The code of the two migrations in the attached extension is also here:
      https://gist.github.com/kasimi/00291a408fb175359b6854f312541cf4

      Can anyone reproduce this?

            Marc Marc
            kasimi kasimi [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: