带有symfony 4的MariaDB 10.0 JSON类型 [英] MariaDB 10.0 JSON type with symfony 4

查看:208
本文介绍了带有symfony 4的MariaDB 10.0 JSON类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Linux服务器上,我有MariaDB版本10.0,该版本不支持json类型(直到10.2版才受支持),并且由于它没有在正式的ubuntu存储库中发布,所以我无法对其进行更新.

当我运行创建表的命令doctrine:migration:migrate时,我从MariaDB收到json类型的语法错误

MariaDB:10.0.34-PHP:7.1-Symfony:4.0.6

我该如何解决这个问题?

解决方案

问题是,Doctrine期望使用MariaDB 10.2+,但是将最新的MariaDB版本放入存储库中存在问题(Arch仍为10.1). >

解决方案在这里: https://symfony.com/doc/current/reference /configuration/doctrine.html#doctrine-dbal-configuration

只需将config/packages/doctrine.yml中的server_version配置为:

doctrine:
dbal:
    # configure these for your database server
    driver: 'pdo_mysql'
    server_version: 'mariadb-10.1.34'
    ...

只需用您可以获取的版本号替换版本

$ mysql --version

In my Linux server, I have MariaDB version 10.0 which does not support json type (supported until version 10.2) and I can't update it because it is not released in official ubuntu repository.

When I run the command doctrine:migration:migrate for creating tables I get a syntax error from MariaDB for json type

MariaDB: 10.0.34 - PHP: 7.1 - Symfony: 4.0.6

How do I solve this issue?

解决方案

The problem is that Doctrine is expecting MariaDB 10.2+, but there have been problems getting the latest MariaDB versions into repos (Arch is still at 10.1).

The solution is here: https://symfony.com/doc/current/reference/configuration/doctrine.html#doctrine-dbal-configuration

Just configure server_version in config/packages/doctrine.yml to:

doctrine:
dbal:
    # configure these for your database server
    driver: 'pdo_mysql'
    server_version: 'mariadb-10.1.34'
    ...

Just replace the version with your version number which you can get with

$ mysql --version

这篇关于带有symfony 4的MariaDB 10.0 JSON类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆