0

My question is about data-load command.

When I made more data-load commands, without rebuild the tables, the ID index from the table is kept ans the first line of table don't begin with ID 1. It's possible with data-load command to insert the data from fixtures and the id for the first line of table to be 1?

j0k
  • 22,600
  • 28
  • 79
  • 90

1 Answers1

0

No you can't. In fact, data-load delete all entries from your database and then load them again. So the autoincrement column aren't resetted (since it performs a DELETE and not a TRUNCATE).

What you can do is before launching data-load, do a TRUNCATE on your table. So any AUTO_INCREMENT value is reset to its start value.

Otherwise, you can use --and-load option from doctrine:build:

./symfony doctrine:build --all --and-load

It will re-generate all classes and SQL files and rebuilt the database then load data from the project and plugin data/fixtures/ directories.

This way, every thing will be fresh, and id resetted.

j0k
  • 22,600
  • 28
  • 79
  • 90
  • Thanck you for your answer! THe problem is that in my database exists more tables wich are related to different modules in one application. The operation 'build' generates all tables, models,etc...It's not ok for my because I want to generate certain tables, 3 of 10 for example, and insert the fixture data into these tables. In the same time, the autoincrement column must be resetted. – Michael Scofield Sep 12 '12 at 15:07
  • Sorry, Because I'am new on this site, I can't post more questions, only comments – Michael Scofield Sep 12 '12 at 15:09