【问题标题】:Symfony Doctrine-fixtures bundle, fail --purge-with-truncateSymfony Doctrine-fixtures 捆绑包,失败 --purge-with-truncate
【发布时间】:2011-12-11 03:44:40
【问题描述】:

我正在使用 DoctrineFixturesBundle 并尝试加载固定装置

app/console -e=test doctrine:fixtures:load --purge-with-truncate

postgres 数据库中的所有数据。但是为什么在 --purge-with-truncate 表序列之后没有重新启动,而只是随着每个夹具加载而增加? 我如何阅读 postgres 截断文档

RESTART IDENTITY
Automatically restart sequences owned by columns of the truncated table(s).

可能是实体生成不正确?

【问题讨论】:

    标签: postgresql doctrine doctrine-orm symfony fixtures


    【解决方案1】:

    使用这个:

    SELECT SETVAL((SELECT pg_get_serial_sequence('person', 'person_id')), 1, false);
    

    表名替换person,用序列字段(列)名替换person_id

    更多详情在这里http://timmurphy.org/2009/11/19/resetting-serial-counters-in-postgresql/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-31
      • 2012-03-03
      • 1970-01-01
      • 1970-01-01
      • 2015-06-05
      • 2023-03-17
      相关资源
      最近更新 更多