Symfony: Rebuild from Schema.yml Without Loss of Data

Home -> Programming -> Web -> Symfony

1125 views

From the computer of: davak (396 recipes)
Created: Jun 27, 2008


Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

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 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.

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.





Related recipes:

  Symfony / Propel: How to Left Join
  Symfony: Fix propel-insert-sql error: Can't connect to local MySQL server
  Symfony: Troubleshooting file uploads
  Symfony: Delete an Application
  Symfony: Add log message manually

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.