Topic: SOLVED fixture generate incorrect data in database

I've created a .yml fixture file, which I'm using to load data in the MySQL database via a data only migration.
All rows get inserted in database, however certain rows have the right data, others get inserted with incorrect data.

For example, my .yml file starts like this:

01001:
  NDB_No: 01001
  Long_Desc: "Butter, salted"
  FR_Desc: beurre salé
01007:
  NDB_No: 01007
  Long_Desc: "Cheese, camembert"
  FR_Desc: camembert
01009:
  NDB_No: 01009
  Long_Desc: "Cheese, cheddar"
  FR_Desc: cheddar

In this example, the row "cheddar" get inserted right in database, however "camembert" and "salted butter" have an incorrect NDB_No:

NDB_No   Long_Desc                  FR_Desc
01009      Cheese, cheddar             cheddar
513            Butter, salted             beurre salé
519            Cheese, camembert     camembert

I don't know where these numbers "513" and "519" come from and I could not find any logical pattern explaining why certain rows are correct and others aren't.

Can this have to do with the accents in French messing up the .yml file, even though it is saved as unicode UTF-8 ?

Last edited by carrot06 (2012-05-21 05:16:56)

Re: SOLVED fixture generate incorrect data in database

I found the answer: in the database, NDB_No has a char(5) type.
It works is the number is enclosed in "" in the .yml file:

01001:
  NDB_No: "01001"
  Long_Desc: "Butter, salted"
  FR_Desc: beurre salé
01007:
  NDB_No: "01007"
  Long_Desc: "Cheese, camembert"
  FR_Desc: camembert
01009:
  NDB_No: "01009"
  Long_Desc: "Cheese, cheddar"
  FR_Desc: cheddar