Search code examples
phpdatabasesymfony1modelsymfony-1.4

Create a new table over an existing symfony instance


as the title suggests, I'm struggling to understand how to create a new table and models and stuff in symfony without destroying everything and losing my data.

I'm running on symfony 1.4 Propel based.

what I'm trying to aim is to create a new table in an existing database via symfony. But if I edit the schema file and then launch

 php symfony doctrine:build-schema

I'm gonna lose all the data. :-0

How can I impact changes in the schema over an already existing database?

thank u so much in advance

cheerz

-k-


Solution

  • Unfortunately, SF 1.x does not have built in migration support. People have used doctrine migrations independently, but I am not aware of a good solution for propel.

    The easiest solution I have seen is to export/backup the data in your current database, run the build-schema command to build the new version, and then import the data back. Its not very elegant, but it works.