How to export primary keys to data dump?

When I export my database with doctrine: data-dump, I face two problems: * primary keys are not exported * instead of foreign key columns correct name, it uses the name of the external table.

For example, here are my tables:

# 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

      

When I dump I find things like this in data.yml:

Planet_1:
  Solarsystem: _1

      

When I load the data it doesn't work (the wrong string is given: (solarsystem) _1, which is referred to in Planet_1). I have to do it manually:

Planet_1:
  solarsystem_id: 1
  planet_id: 1

      

At the moment I am fixing the data.yml manually, but it starts to get a pain with all the entries I am accumulating ...

Note. I am using Symfony 1.4, Doctrine, postgreSQL, NetBeans, Windows. Feel free to ask for information that you find helpful.

thanks for the help

+2


a source to share


1 answer


I recommend checking out this article titled "Never Trust doctrine: data-dump": http://www.thomaskeller.biz/blog/2010/01/29/never-trust-doctrinedata-dump/

With that in mind, you might want to check the pg_dump check instead: http://www.postgresql.org/docs/8.1/static/backup.html#BACKUP-DUMP



This dump is postgreSQL layer and, as such, is unlikely to care about your Doctrine schema - or stumble upon it.

+1


a source







All Articles