Skip to content
This repository has been archived by the owner on Apr 8, 2018. It is now read-only.

Add docs for pre*, post* and *if methods #9

Open
webdevilopers opened this issue Nov 13, 2014 · 0 comments
Open

Add docs for pre*, post* and *if methods #9

webdevilopers opened this issue Nov 13, 2014 · 0 comments

Comments

@webdevilopers
Copy link

At the moment there are no docs for the pre* and post* methods:
https://github.com/doctrine/migrations/blob/master/lib/Doctrine/DBAL/Migrations/AbstractMigration.php#L166-180
at
http://doctrine-migrations.readthedocs.org/en/latest/index.html

Though the Schema (by @beberlei) is injected into the method using it does not seem to have an effect as noticed by @neraath (and @ruippeixotog ?) in:
http://stackoverflow.com/questions/5564945/remove-column-in-postup-method#6170121

An example use case:
https://gist.github.com/webdevilopers/0888dcc05b9d7f0f99ac

I also realized that any query no a prepared statement is executed even using the option --write-sql. Is this an expected behaviour of the postUp() method?

To prevent this I used the isMigrated method:

if ($this->version->isMigrated() !== true) echo 'Not migrated yet. Exiting post-up.'; exit;

But I think alternatively you can use the *if (e.g. skipIf) methods which are not documented yet too.

Possibly related in Symfony Bundle https://github.com/doctrine/DoctrineMigrationsBundle :

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

No branches or pull requests

1 participant