doctrine:schema:update不是更新表

时间:2017-01-10 15:35:08

标签: php symfony doctrine-orm doctrine

为什么bin/console doctrine:schema:update --force没有更新数据库表?

这是一个实体:

/**
 * @ORM\Table(name="country")
 * @ORM\Entity(repositoryClass="CoreBundle\Repository\CountryRepository")
 */
class Country
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", unique=true)
     */
    private $name;

    /**
     * @var boolean
     *
     * @ORM\Column(name="active", type="boolean")
     */
    private $active;

    ....
    }

已创建表country,但只有id列。 我一直收到Nothing to update - your database is already in sync with the current entity metadata.,但未添加nameactive

我也在添加Doctrine配置

doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true

更新

问题在于Redis。如果我从config.yml中删除doctrine缓存配置,一切正常

1 个答案:

答案 0 :(得分:2)

bin/console doctrine:cache:clear-metadata命令解决了问题,表格已更新