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

Backward compatibility database json type #123

Closed
nick322 opened this issue Mar 25, 2022 · 1 comment
Closed

Backward compatibility database json type #123

nick322 opened this issue Mar 25, 2022 · 1 comment

Comments

@nick322
Copy link

nick322 commented Mar 25, 2022

What is the issue?

I found file in "database/migrations/create_settings_table.php.stub"
Line 17

$table->json('payload');

when I run

php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations"
php artisan migrate

then after show Error


In Connection.php line 712:
--
762 |  
763 | SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i
764 | n your SQL syntax; check the manual that corresponds to your MySQL server v
765 | ersion for the right syntax to use near 'json not null, `created_at` timest
766 | amp null, `updated_at` timestamp null) default' at line 1 (SQL: create tabl
767 | e `settings` (`id` bigint unsigned not null auto_increment primary key, `gr
768 | oup` varchar(191) not null, `name` varchar(191) not null, `locked` tinyint(
769 | 1) not null, `payload` json not null, `created_at` timestamp null, `updated
770 | _at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode
771 | _ci')
772 |  
773 |  
774 | In Connection.php line 495:
775 |  
776 | SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error i
777 | n your SQL syntax; check the manual that corresponds to your MySQL server v
778 | ersion for the right syntax to use near 'json not null, `created_at` timest
779 | amp null, `updated_at` timestamp null) default' at line 1

because mysql version is 5.6 ...
it not support json type.
So I plan to add version checking. #124

@rubenvanassche
Copy link
Member

For future users finding this issue, @nick322's solution is to replace for MySQL 5.6 installations in the settings migration the following line

$table->json('payload');

with:

$table->longText('payload');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants