Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Use Schema methods instead of SQL #10

schoren opened this Issue · 1 comment

2 participants


I've noticed the generated migrations are using SQL instead of the Schema class methods. I think the most logic thing to do is to use those methods. Right now it generates a SQL command for the RDBM in use (in my case, mysql), but if i want to change to Postgres for example, i have to rebuild all my migrations.


This bundles simply integrates the Doctrine DataFixtures library. It does nothing about generating the code of the migrations, which is why I close this issue.

And the reason why DataFixtures uses SQL is that it gives the developer full power about adding additional queries at any state of the migration whereas the Schema does not. A good example where it is needed is the addition of a unique field in a table. If you do the full schema migration, it will fail as soon as there is at least 2 rows in the table because both are set to the same default value => not unique. DataFixtures generates 2 queries to do this migration: adding the field and then adding the unique constraint. This makes it possible to add a third query between them that populate the new field with some unique data (copying the primary key for instance)

@stof stof closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.