Propel2
Propel2 copied to clipboard
Swap getUpSQL and getDownSQL
I have an existing db, generated schema.xml
, then added new column to the db and run propel diff
In a generated migration I see getUpSQL
dropping the field and getDownSQL
adding new field
I think getUpSQL
and getDownSQL
should be swapped here https://github.com/propelorm/Propel2/blob/431b8d059b660fc5afc674cb90c15b5e23af3089/src/Propel/Generator/Command/MigrationDiffCommand.php#L218-L219
Or I just use Propel in a wrong way)
@melnikaite you should modify schema.xml
and run propel diff
.
if you can modify your DB, you already have the right DDL so no need for propel diff
.
http://propelorm.org/documentation/09-migrations.html#migration-workflow
The workflow we have (same issue) is that we first modify DB in our dev system directly, and then want to roll it out to our various production environments.
The advantage of this approach is that it is quite simple: We use GUI tools like phpmyadmin to edit the DB structure, and then make sure the application runs with the new structure. In this approach, there is no need to learn the Propel-specific XML format for DB structures.
That's not an advantage, it's sloppy. Use the schema and diff set to manage the changes in your database. Review how ORMs work and why you should manage chnagesets and not modify your database directly. This is an ORM toolset.