laravel-model-stats icon indicating copy to clipboard operation
laravel-model-stats copied to clipboard

Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'body' can't have a default value

Open Oxicode opened this issue 4 years ago • 6 comments

BUG Installation image

PHP version image

Mysql Version image

Oxicode avatar Jun 25 '21 18:06 Oxicode

Hey, I’m usually working with PostgreSQL. I didn’t get a chance to try the package with MySQL. I think removing the default value from the migration and adding a default value in the ‘$attributes’ property of the dashboard Model would fix it. I’ll try to take a look at it this week. If you have some time to try that change, please feel free to 😉

JhumanJ avatar Jun 25 '21 19:06 JhumanJ

has this been resolved?

Eolykab avatar Jul 07 '21 16:07 Eolykab

image

leandrofacim avatar Jul 07 '21 19:07 leandrofacim

I don't use Mysql so if anyone can try to implement the fix I suggested above, I'd appreciate. Otherwise I'll try to take a look tomorrow.

JhumanJ avatar Jul 07 '21 19:07 JhumanJ

Removing the default value actually works but it isn't the better way to solve the problem, I switched from jsonb to varchar and setted the default value through Datagrip, and it's working in my local environment, I even mocked data using a production dump and it's working perfectly

leandrofacim avatar Jul 07 '21 20:07 leandrofacim

Then we can remove it only for mysql. Of course, in any cases we need to add the default value on the model attributes. I created this PR #3 to try the fix. I don't have the right setup to test it. Can one of you try @leandrofacim @Eolykab @Oxicode ?

JhumanJ avatar Jul 07 '21 20:07 JhumanJ