When I run:
php artisan migrate
and want to modify a string field to a text field like this:
//the old field that i want to modify in migration file
$table->string('description')->nullable();
//and the new text field
$table->text('description')->change();
I get the following error:
Unknown database type json requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.
try this solution may be this will work for you,
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('json', 'text');
}
For further reading about this issue check Issue #15772 at laravel repo
If you found this question at google, but your case is Symfony, but not Laravel - this is an answer.
Had same issue: Unknown database type json requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
at Symfony/Sylius.
The reason - I had serverVersion=5.5
rather than serverVersion=5.7
at my app's .env
file, when doctrine 2.6+
was installed by composer.
So right DATABASE_URL
will be: DATABASE_URL=mysql://[email protected]/database_%kernel.environment%?serverVersion=5.7
If using Symfony, you have to make sure your dbal config is pointing at the correct server version:
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: utf8mb4
server_version: 5.7
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
engine: InnoDB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With