migrate\Plugin\migrate\id_map\Sql assumes a PDO db driver

Created on 22 September 2023, 9 months ago
Updated 9 October 2023, 9 months ago

Problem/Motivation

This code in Sql::ensureTables()

        try {
          $this->getDatabase()
            ->schema()
            ->createTable($this->mapTableName, $schema);
          break;
        }
        catch (DatabaseException $e) {
          $pdo_exception = $e->getPrevious();
          $mysql_index_error = $pdo_exception instanceof \PDOException && $pdo_exception->getCode() === '42000' && $pdo_exception->errorInfo[1] === 1071;
          $chunk_size--;
          // Rethrow the exception if the source IDs can not be in smaller
          // groups.
          if (!$mysql_index_error || $chunk_size <= 0) {
            throw $e;
          }
        }

assumes the DB driver is one implementing a PDO connection.

This blocks ๐Ÿ“Œ [PP-1] Create the database driver for MySQLi Postponed that would be a non-PDO implementation.

Proposed resolution

Make that code db-driver abstract.

Implement two specific exceptions inheriting from SchemaException to cover the case of column too large and key too large, and throw them from mysql driver's ExceptionHandler. Change migrate's Sql to catch the new exceptions accordingly.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Fixed

Version

11.0 ๐Ÿ”ฅ

Component
Migrationย  โ†’

Last updated about 23 hours ago

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024