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

RC2 Migration Fails - JSON column cannot have default value #343

Closed
vmitchell85 opened this issue Sep 6, 2018 · 3 comments
Closed

RC2 Migration Fails - JSON column cannot have default value #343

vmitchell85 opened this issue Sep 6, 2018 · 3 comments
Labels

Comments

@vmitchell85
Copy link

When attempting to migrate the database I get the following error:

SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'options' can't have a default value (SQL: create table 'abilities' ('id' int unsigned not null auto_increment primary key, 'name' varchar(150) not null, 'title' varchar(255) null, 'entity_id' int unsigned null, 'entity_type' varchar(150) null, 'only_owned' tinyint(1) not null default '0', 'options' json null default '{}', 'scope' int null, 'created_at' timestamp null, 'updated_at' timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

I'm running MySQL 5.7.22 and I found the following in the MySQL documentation:

A JSON column cannot have a default value.

It seems like the fix would be just to remove the default value that is set in the migration.

@looksystems
Copy link

Same here.

See also: laravel/framework#16107

@bkuhl
Copy link
Contributor

bkuhl commented Sep 8, 2018

It also doesn't make sense to define a default and a nullable column.

@JosephSilber
Copy link
Owner

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

No branches or pull requests

4 participants