Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12643

Cannot convert SQLite DB from 3.0.12 to 3.1.0

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-b4
    • Fix Version/s: 3.1.0-RC1
    • Labels:
      None
    • Environment:
      PHP 5.4.23, SQLite 3.7.7.1, MSIE 11.0

      Description

      Failing to convert DB from 3.0.12, step: process update from 3.1.0-dev

      SQL ERROR [ sqlite3 ]

      table phpbb_forums has no column named forum_posts_approved [1]

      SQL

      INSERT INTO phpbb_forums (display_subforum_list,forum_id,parent_id,left_id,right_id,forum_parents,forum_name,forum_desc,forum_desc_bitfield,forum_desc_options,forum_desc_uid,forum_link,forum_password,forum_style,forum_image,forum_rules,forum_rules_link,forum_rules_bitfield,forum_rules_options,forum_rules_uid,forum_topics_per_page,forum_type,forum_status,forum_topics,forum_topics_real,forum_last_post_id,forum_last_poster_id,forum_last_post_subject,forum_last_post_time,forum_last_poster_name,forum_last_poster_colour,forum_flags,display_on_index,enable_indexing,enable_icons,enable_prune,prune_next,prune_days,prune_viewed,prune_freq,forum_options,forum_posts_approved,forum_posts_unapproved,forum_posts_softdeleted,forum_topics_approved,forum_topics_unapproved,forum_topics_softdeleted) SELECT display_subforum_list,forum_id,parent_id,left_id,right_id,forum_parents,forum_name,forum_desc,forum_desc_bitfield,forum_desc_options,forum_desc_uid,forum_link,forum_password,forum_style,forum_image,forum_rules,forum_rules_link,forum_rules_bitfield,forum_rules_options,forum_rules_uid,forum_topics_per_page,forum_type,forum_status,forum_topics,forum_topics_real,forum_last_post_id,forum_last_poster_id,forum_last_post_subject,forum_last_post_time,forum_last_poster_name,forum_last_poster_colour,forum_flags,display_on_index,enable_indexing,enable_icons,enable_prune,prune_next,prune_days,prune_viewed,prune_freq,forum_options,forum_posts_approved,forum_posts_unapproved,forum_posts_softdeleted,forum_topics_approved,forum_topics_unapproved,forum_topics_softdeleted FROM phpbb_forums_temp;

      BACKTRACE

      FILE: (not given by php)
      LINE: (not given by php)
      CALL: msg_handler()

      FILE: [ROOT]/phpbb/db/driver/driver.php
      LINE: 745
      CALL: trigger_error()

      FILE: [ROOT]/phpbb/db/driver/sqlite3.php
      LINE: 133
      CALL: phpbb\db\driver\driver->sql_error()

      FILE: [ROOT]/phpbb/db/tools.php
      LINE: 1506
      CALL: phpbb\db\driver\sqlite3->sql_query()

      FILE: [ROOT]/phpbb/db/tools.php
      LINE: 2017
      CALL: phpbb\db\tools->_sql_run_sql()

      FILE: [ROOT]/phpbb/db/tools.php
      LINE: 909
      CALL: phpbb\db\tools->sql_column_remove()

      FILE: (not given by php)
      LINE: (not given by php)
      CALL: phpbb\db\tools->perform_schema_changes()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 457
      CALL: call_user_func_array()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 403
      CALL: phpbb\db\migrator->run_step()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 242
      CALL: phpbb\db\migrator->process_data_step()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 204
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 204
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 204
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 204
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 204
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 204
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/phpbb/db/migrator.php
      LINE: 155
      CALL: phpbb\db\migrator->try_apply()

      FILE: [ROOT]/install/database_update.php
      LINE: 234
      CALL: phpbb\db\migrator->update()

        Activity

        Hide
        Boris Berdichevski Boris Berdichevski added a comment - - edited

        phpbb\db\tools.php
        Find
        $new_table_cols = trim(preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols));
        Replace to:
        $new_table_cols = trim(preg_replace('/' . $column_name . '\b[^,]+(?:,|$)/m', '', $new_table_cols));

        Find (line 2558)
        $new_table_cols = trim($matches[1]);

        Replace to:
        $new_table_cols = trim(preg_replace('/.PRIMARY KEY*\s*(\w*,.*/', '', $matches[1]));

        if (substr($new_table_cols, -1) === ',')

        { // Remove the comma from the last entry again $new_table_cols = substr($new_table_cols, 0, -1); }
        Show
        Boris Berdichevski Boris Berdichevski added a comment - - edited phpbb\db\tools.php Find $new_table_cols = trim(preg_replace('/' . $column_name . ' [^,] +(?:,|$)/m', '', $new_table_cols)); Replace to: $new_table_cols = trim(preg_replace('/' . $column_name . '\b [^,] +(?:,|$)/m', '', $new_table_cols)); Find (line 2558) $new_table_cols = trim($matches [1] ); Replace to: $new_table_cols = trim(preg_replace('/.PRIMARY KEY*\s*(\w*,.*/', '', $matches [1] )); if (substr($new_table_cols, -1) === ',') { // Remove the comma from the last entry again $new_table_cols = substr($new_table_cols, 0, -1); }
        Hide
        Boris Berdichevski Boris Berdichevski added a comment -

        Please commit-push the fix & you can close the BUG issue.

        Show
        Boris Berdichevski Boris Berdichevski added a comment - Please commit-push the fix & you can close the BUG issue.
        Hide
        Noxwizard Patrick Webster added a comment -

        This does affect SQLite2 conversions.

        Show
        Noxwizard Patrick Webster added a comment - This does affect SQLite2 conversions.
        Hide
        Boris Berdichevski Boris Berdichevski added a comment - - edited

        I've checked with changes of https://github.com/phpbb/phpbb/pull/2607/files
        Fixed.
        But I'll open a new BUG report, it doesn't depended this.
        https://tracker.phpbb.com/browse/PHPBB3-12727

        Show
        Boris Berdichevski Boris Berdichevski added a comment - - edited I've checked with changes of https://github.com/phpbb/phpbb/pull/2607/files Fixed. But I'll open a new BUG report, it doesn't depended this. https://tracker.phpbb.com/browse/PHPBB3-12727
        Hide
        bantu Andreas Fischer added a comment -

        Thank you.

        Show
        bantu Andreas Fischer added a comment - Thank you.

          People

          • Assignee:
            bantu Andreas Fischer
            Reporter:
            Boris Berdichevski Boris Berdichevski
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development