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

migrate command executes migrations when --write-sql is passed, output is incomplete #1082

Closed
donataso opened this issue Nov 26, 2020 · 7 comments
Labels

Comments

@donataso
Copy link

Bug Report

According to documentation, migrate --write-sql should not execute any migrations and provide doctrine_migration_versions insert/delete queries, but it executes and does not provide version update queries.

It used to work correctly in version 2.

Q A
BC Break yes
Version 3.*

Summary

Described above.

Current behavior

  • --write-sql does not prevent migrations from being executed
  • --write-sql output does not include versions tracking table update queries

How to reproduce

Run any migration with a --write-sql option.

Expected behavior

  • migration is not executed
  • output contains versions tracking table update query
@goetas
Copy link
Member

goetas commented Feb 7, 2021

did you try using he --dry-run parameter?

@Zombaya
Copy link

Zombaya commented Feb 8, 2021

Using the --dry-run-parameter will only solve the part of the issue where no migrations should be executed. This is actually described in UPGRADE.md for doctrine version 3.1, so that is working as expected, I guess.

The --write-sql option for migrations:migrate and migrations:execute does not imply dry-run anymore,
use the --dry-run parameter instead.

This does not solve the other problem @donataso mentions. You still have to manually create the INSERT INTO migration_versions (version, executed_at, execution_time) VALUES ("myversion",NOW(),NULL) or DELETE FROM migration_versions WHERE version = "myversion"-query. This used to be included in the sql-file as well but is now completely missing.

I would also prefer it to be included into the output versus updating the documentation to state that you will manually have to write that query.

@goetas
Copy link
Member

goetas commented Feb 8, 2021

This does not solve the other problem @donataso mentions. You still have to manually create the INSERT INTO migration_versions (version, executed_at, execution_time) VALUES ("myversion",NOW(),NULL) or DELETE FROM migration_versions WHERE version = "myversion"-query. This used to be included in the sql-file as well but is now completely missing.

I would also prefer it to be included into the output versus updating the documentation to state that you will manually have to write that query.

makes sense

@goetas goetas added the Bug label Feb 8, 2021
@donataso
Copy link
Author

donataso commented Feb 9, 2021

One more additional note:
when using --write-sql option, PDO bind params are not included in the queries - questions marks are shown instead.

@Zombaya
Copy link

Zombaya commented Feb 10, 2021

when using --write-sql option, PDO bind params are not included in the queries - questions marks are shown instead.

For reference: this was always the case, this has not been changed because of migrating to version 3.

@rimvislt
Copy link

rimvislt commented Aug 2, 2021

--dry-run does not include doctrine_migration_versions inset/updates commands too.

Seems old issue, I found the same problems recently as mentioned here and will be good to get this fixed.

@wiistriker

This comment was marked as spam.

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

No branches or pull requests

6 participants