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

Error on migration #61

Closed
bennettscience opened this issue Feb 7, 2019 · 5 comments
Closed

Error on migration #61

bennettscience opened this issue Feb 7, 2019 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@bennettscience
Copy link
Contributor

bennettscience commented Feb 7, 2019

Starting with a fresh v4 installation, trying to migrate from an old Lychee database. The following error returns on the first artisan migrate command:

Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_username_unique`(`username`))

Current lychee install is v 3.2.11
DB: update_030211

@d7415
Copy link
Contributor

d7415 commented Feb 7, 2019

Out of curiosity, which MySQL/MariaDB version are you using?

@ildyria ildyria added the bug Something isn't working label Feb 7, 2019
@bennettscience
Copy link
Contributor Author

Here's my STATUS dump:

MariaDB [(none)]> status;
--------------
mysql  Ver 15.1 Distrib 10.1.37-MariaDB, for debian-linux-gnueabihf (armv8l) using readline 5.2

Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.1.37-MariaDB-0+deb9u1 Raspbian 9.0
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4

@jgbellin
Copy link

jgbellin commented Feb 7, 2019

try to edit the /config/database.php file :
at line 50,
repace 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci',
with 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci',
it should work (worked for me)

@ildyria
Copy link
Member

ildyria commented Feb 8, 2019

@jgbellin but you are losing the multi byte version of utf8mb4 which add emojies and cover additional characters: https://stackoverflow.com/a/30074553/3981163
Might be useful for the cn people...

@bennettscience
Copy link
Contributor Author

bennettscience commented Feb 17, 2019

Ok, finally looping back to this. I removed all Laravel directories and tables. Short of rebuilding the server, I was starting from a blank slate. Running php artisan migrate continues to throw the key error.

In Connection.php line 664:
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_username_unique`(`username`))

Following @jgbellin's advice, changing /config/database.php allowed the migration to proceed without error. I don't know enough PHP to debug this one, though.

@ildyria ildyria added this to the v4.0.0 milestone Feb 17, 2019
ildyria added a commit that referenced this issue Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants