Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-30374

[SchemaBuilder] Missing PK column length in generated SQL

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 2.5.0
    • 2.5.0-rc2
    • None
    • MySQL 5.7+ with innodb_large_prefix=OFF configuration setting.

    Description

      For the following Yaml schema definition:

      ezprest_authcode:         id:             id: { type: string, nullable: false, length: 200, options: { default: '', lengths: [191] } }
      

      the SQL output is:

      CREATE TABLE ezprest_authcode (
        id VARCHAR(200) DEFAULT '' NOT NULL,
        PRIMARY KEY(id)
      );
      

      but it should be:

      CREATE TABLE ezprest_authcode (
        id VARCHAR(200) NOT NULL DEFAULT '',
        PRIMARY KEY (id (191))
      );
      

      (PK column length is missing).

      It breaks installation process (./bin/console ezplatform:install) for MySQL 5.7+ with innodb_large_prefix set to OFF with the following error:

        An exception occurred while executing 'CREATE TABLE ezprest_authcode (id VARCHAR(200) DEFAULT '' NOT NULL, client_id VARCHAR(200) DEFAULT '' NOT NULL, expirytime BIGINT DEFAULT 0 NOT NULL, scope VARCHAR(200) DEFAULT NULL, user_id INT DEFAULT 0 NOT NULL, INDEX authcode_client_id (client_id(191)), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci ENGINE = InnoDB':                                                                                                                                                                     
                                                                                                                                                                                                   
        SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.longosz@ibexa.co Andrew Longosz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 45 minutes
                1h 45m