1
votes

I make my first steps in the symfony plugin world, and I'm a bit lost...

I have a live app with a database. Usually, when I need a new table or field I do a migration, by updating my schema.yml, calling the generate-migration-diff and build --all-classes --and-migrate symfony commands.

Today, I need to install a plugin (i.e, sfCombinePlugin) in order to minify my js and css scripts. I installed it via the symfony plugin:install command, it's ok I've got all my files in the plugins folder. I follow the read-me, it says to build the model, so I run the command doctrine:build-model, and a folder sfCombinePlugin appears in my lib/model/doctrine folder.

But now I'm stuck, I need to add the table in my database. In the read- me it says, to generate the sql via doctrine:build-sql, and run the generated sql in my database. But I see some issues coming...

Will it erase my data by running the sql file? I pretty sure it will, because it create the database from scratch...

So, I would like to use a migration, as I do usually. But when I run the generate-migration-diff, it doesn't take in account the schema.yml from the plugin folder. Is it normal or is it a bug?

I've thought of copying the content of the schema.yml plugin inside the schema.yml app file, but I'm not sure this is a good idea, because the model classes will not be in the sfCombinePlugin folder but in the general model folder. And it sounds not good.

1

1 Answers

0
votes

build-sql will just create the SQL files; insert-sql would overwrite the database. When I do table adding like this, I have just looked in the generated SQL in data/sql and added the tables by hand. s2 has migrations built in, IIRC. For s1.4 check out http://www.symfony-project.org/plugins/sfPropelMigrationsLightPlugin - just found via google, I've never used it.