MariaDB 10.0 JSON 类型与 symfony 4 [英] MariaDB 10.0 JSON type with symfony 4

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

问题描述

在我的 Linux 服务器中,我有 MariaDB 版本 10.0,它不支持 json 类型(直到版本 10.2 才支持),我无法更新它,因为它没有在官方 ubuntu 存储库中发布.

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.

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

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

MariaDB: 10.0.34 - PHP: 7.1 - Symfony: 4.0.6

我该如何解决这个问题?

How do I solve this issue?

推荐答案

问题是 Doctrine 期待 MariaDB 10.2+,但是将最新的 MariaDB 版本放入 repos 时出现问题(Arch 仍然是 10.1).

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).

p>

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

只需在 config/packages/doctrine.yml 中配置 server_version 即可:

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

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

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