Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.33k stars 588 forks source link

JSON Column Converting to Text #173

Open arelidev opened 6 years ago

arelidev commented 6 years ago

I ran into an issue when running artisan migrate:generate where json columns converted to text.

ajnozari commented 5 years ago

This is probably due to MariaDB support since that doesn’t use the json table format. Instead it dynamically links all calls for “json” to “text” in the background.

If you’re using MySQL you do get JSON column support and can safely change that back to JSON.

Note that MariaDB will just ignore JSON and treat it as text if you do this.

MahdiMajidzadeh commented 5 years ago

jsonb convert to text! why??

ajnozari commented 5 years ago

Last I checked mariadb doesn’t support the JSON column and instead auto-converts it to text and stores that. When you ask for the data you get the raw string back which should be parseable, you can also just parse the string if it’s not recognized as JSON and then use it.