当我使用export :data-dump导出我的数据库时,我遇到了两个问题:*主键没有被导出*而不是外键列的正确名称,它使用外表的名称。
例如,下面是我的表格:
# schema.yml
Planet:
connection: doctrine
tableName: planet
columns:
planet_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
sequence: planet_planet_id
solarsystem_id:
type: integer(4)
fixed: false
unsigned: false
notnull: false
primary: false
# some columns...
relations:
Solarsystem:
local: solarsystem_id
foreign: solarsystem_id
type: one
# other relations...
Solarsystem:
connection: doctrine
tableName: solarsystem
columns:
solarsystem_id:
type: integer(4)
fixed: false
unsigned: false
primary: true
sequence: solarsystem_solarsystem_id
# other columns...
relations:
Planet:
local: solarsystem_id
foreign: solarsystem_id
type: many
# other relations当我转储时,我在data.yml中找到了类似的东西:
Planet_1:
Solarsystem: _1当我加载数据时,它不工作(指定了无效的行键:在(planet) Planet_1中引用的(solarsystem) _1 )。我必须像这样手动修复:
Planet_1:
solarsystem_id: 1
planet_id: 1目前,我正在手动修复data.yml,但随着我积累的所有记录,它开始变得痛苦起来……
注意:我使用的是Symfony 1.4,Doctrine,postgreSQL,NetBeans,Windows。请随时询问您认为有用的信息。
谢谢你的帮忙
发布于 2011-01-13 15:23:39
我推荐阅读这篇题为“永不信任原则:数据转储”的文章:http://www.thomaskeller.biz/blog/2010/01/29/never-trust-doctrinedata-dump/
考虑到这一点,您可能更喜欢查看pg_dump:http://www.postgresql.org/docs/8.1/static/backup.html#BACKUP-DUMP
这个转储是postgreSQL级别的,因此不太可能关心您的信条模式,也不太可能被它绊倒。
https://stackoverflow.com/questions/2801214
复制相似问题