Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap getUpSQL and getDownSQL #1877

Open
melnikaite opened this issue May 3, 2022 · 3 comments
Open

Swap getUpSQL and getDownSQL #1877

melnikaite opened this issue May 3, 2022 · 3 comments

Comments

@melnikaite
Copy link

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

$migrationsUp[$name] = $platform->getModifyDatabaseDDL($databaseDiff);
$migrationsDown[$name] = $platform->getModifyDatabaseDDL($databaseDiff->getReverseDiff());

Or I just use Propel in a wrong way)

@ikeyan
Copy link
Contributor

ikeyan commented May 9, 2022

@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

@ghost
Copy link

ghost commented Feb 27, 2023

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.

@SourceCode
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants