Skip to content

Migration failed: 1071 Specified key was too long #104

@MDXDave

Description

@MDXDave

*** applying m190417_133209_init
> create table {{%User}} ... done (time: 0.291s)
> create unique index idx_User_email on {{%User}} (email) ...Exception: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
The SQL being executed was: ALTER TABLE User ADD UNIQUE INDEX idx_User_email
...
*** failed to apply m190417_133209_init (time: 0.293s)

0 from 1 migrations were applied.

Migration failed. The rest of the migrations are canceled.
Script @php yii migrate/up --interactive=0 handling the 304952f34c6bafa760b525408c8f0c941565000511 event returned with error code 1
Script presentator\api\base\Starter::postCmd handling the post-install-cmd event terminated with an exception

The fix is easy, just apply the following options to your mysql database (global, you will need root access to your database):

Set global innodb_file_format=Barracuda;
Set global innodb_large_prefix=1;
Set global innodb_default_row_format=dynamic;

@ganigeorgiev maybe you should mention this in the installation instructions 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions