Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database initial migration failed #163

Closed
lukeholder opened this issue Sep 3, 2016 · 1 comment · Fixed by #156
Closed

Database initial migration failed #163

lukeholder opened this issue Sep 3, 2016 · 1 comment · Fixed by #156
Assignees
Labels
Milestone

Comments

@lukeholder
Copy link

Trying to get the new website running locally to contribute.

Are there specific requirements for the mysql database setup? getting this error when running ./yii migrate

getting error: Specified key was too long; max key length is 767 bytes.\

767 bytes is the stated prefix limitation for InnoDB tables - its 1,000 bytes long for MyISAM tables.

Are the database requirements anywhere for this project?

➜  yiiframework.com git:(master) ✗ ./yii migrate
Yii Migration Tool (based on Yii v2.0.9)

Creating migration history table "migration"...Done.
Total 4 new migrations to be applied:
    m150416_155549_create_user_and_auth_tables
    m150416_155923_create_comment_table
    m160510_225827_create_news_table
    m160824_095813_create_news_tags_table

Apply the above migrations? (yes|no) [no]:yes
*** applying m150416_155549_create_user_and_auth_tables
    > create table {{%user}} ... done (time: 0.007s)
    > create unique index idx-user-username-unique on {{%user}} (username) ... done (time: 0.019s)
    > create unique index idx-user-email-unique on {{%user}} (email) ...Exception 'yii\db\Exception' with message '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-unique` (`email`)'

in /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/db/Schema.php:633

Error Info:
Array
(
    [0] => 42000
    [1] => 1071
    [2] => Specified key was too long; max key length is 767 bytes
)

Stack trace:
#0 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/db/Command.php(854): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE `us...')
#1 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/db/Migration.php(444): yii\db\Command->execute()
#2 /Users/lh/Code/Playground/yiiframework.com/migrations/m150416_155549_create_user_and_auth_tables.php(23): yii\db\Migration->createIndex('idx-user-email-...', '{{%user}}', 'email', true)
#3 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(509): m150416_155549_create_user_and_auth_tables->up()
#4 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(130): yii\console\controllers\BaseMigrateController->migrateUp('m150416_155549_...')
#5 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#6 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#7 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/base/Controller.php(154): yii\base\InlineAction->runWithParams(Array)
#8 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/console/Controller.php(119): yii\base\Controller->runAction('', Array)
#9 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/base/Module.php(454): yii\console\Controller->runAction('', Array)
#10 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate', Array)
#11 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate', Array)
#12 /Users/lh/Code/Playground/yiiframework.com/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#13 /Users/lh/Code/Playground/yiiframework.com/yii(27): yii\base\Application->run()
#14 {main}

@cebe
Copy link
Member

cebe commented Sep 3, 2016

Yeah, I have seen that myself too, should be fixed in the user management branch (#156) already, you can comment the lines for index creation from the migration to work around it for now.
Thanks for reporting!

@cebe cebe added the bug label Sep 3, 2016
@cebe cebe added this to the launch milestone Sep 3, 2016
@cebe cebe self-assigned this Sep 3, 2016
@cebe cebe closed this as completed in #156 Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants