area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.75k stars 572 forks source link

Getting MySQL error when migrating DB #2

Closed msurguy closed 6 years ago

msurguy commented 6 years ago

Running php artisan twill:setup causes the error specified in the screenshot:

1071 Specified key was too long; max key length is 767 bytes (SQL: alter table activity_log add index activity_log_log_name_index(log_name))

screen shot 2018-07-05 at 11 07 58 am

I'm running MAMP with MySQL Server version: 5.6.38 - MySQL Community Server (GPL)

ifox commented 6 years ago

Hi @msurguy! Thanks for reporting your issue, we're so glad to see someone already trying Twill!

Since Laravel 5.4, a change was made to the default database character set, and it’s now utf8mb4 which includes support for storing emojis. As long as you are running MySQL v5.7.7 and higher you do not need to do anything.

Since you're running MySQL v5.6.38, you would need to add the following to your AppServiceProvider.php file boot method:

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

References: Laravel News - Laravel documentation

msurguy commented 6 years ago

Thanks @ifox! That helped to get through the first problem!

Now, it complains about some other MySQL error that I suspect to be also coming from MySQL version but not sure...

Thanks for bearing with me through these initial steps!

screen shot 2018-07-05 at 11 41 25 am
ifox commented 6 years ago

You got it right @msurguy, your MySQL version does not support the JSON column type, which was introduced in MySQL 5.7, and is used by Twill.

There's a Gist discussion here about upgrading MAMP's MySQL to 5.7. I did not try it but some users seem to figure it out this way.

You might want to take a look at laravel/valet or laravel/homestead if you are interested in moving away from MAMP.

Thanks again, I'll make sure to update our docs with a more precise requirements section as Twill is not supporting MySQL versions older than 5.7.

msurguy commented 6 years ago

@ifox got it! Thanks for the pointers and suggestions! I'll try this out on Valet probably next week as I'm working hard on grad school and other projects :)

I really am looking forward to getting this to run, was dreaming about building a similar product myself a while ago (kinda like https://carrd.co/) so am very grateful that someone built the whole system and open sourced it!