HomeWeb application programmingSymfonySymfony: Rebuild from Schema.yml Without Loss of Data

Symfony: Rebuild from Schema.yml Without Loss of Data

As my test database became more complex, I hated entering data again after doing a propel-build-all. Following these commands, you can save your database content after rebuilding your database from your schema file.


After changing the schema.yml file, the user typically uses propel to rebuild. One of the unfortunate side effects of this is loss of data in the database.

Following these commands will dump the database, rebuild from the new schema.yml file, and then reload the content.

Note: I would trust this on test data. Consider additional backup measures before using this on a real database.

frontend is my application name here. dump.yml can be named whatever yml is desired.

php symfony propel-dump-data frontend dump.yml
php symfony cc
php symfony propel-build-all-load frontend

In symfony 1.1 and later the dump and reload commands are the following:
php symfony propel:data-dump
php symfony propel:data-load

In order, this does the following:

– This dumps the database associated with the frontend app.
– Clears the symfony cache
– Then does a build-all and reloads the database.

Enjoy more coding and less test data generating.

David Kirk
David Kirk
David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
RELATED ARTICLES

4 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments

Cleveland Furia on How to Clear Google Activity
Sid Wohlfarth on How to Clear Google Activity
Riley Magsayo on How to Clear Google Activity
สมัครรับเครดิตฟรี ทันที on How to improve Remote Desktop Protocol Performance
Neal Wangstad on How to Clear Google Activity
Slavcho Andov on How to install Ubuntu
Slavcho Andov on How to fix bad sectors
Sheraz Ali on How to Backup Android