Wednesday, June 23, 2010

Create MySQL Dump to Save Data Before doctrine:build

If you use the symfony doctrine:build --all command, all data will be deleted in the database. To fix this, you have to save the data before the building and then import the dump file...
  1. mysqldump -t -c -u root -p DBNAME > dump.sql
  2. symfony doctrine:build --all
  3. mysql -u root -p DBNAME < dump.sql
Note: On Windows, you have to add the path (the mysql/bin directory) to the environmental variables.
Note2: The -t parameter removes the drop table and create table queries from the dump. It is needed if you change the structure of a table, otherwise drop table query will delete what symfony doctrine:build created.
Note3: The -c parameter adds the column names to INSERT INTO statements.

No comments:

Post a Comment