Details
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