Add change() method to migrations
The idea is to implement the same code as in up() and determine how to roll back migration based on it. Migration in this case should be like a query and a builder that has two modes: up and down.
It already exists in some third party libs such as https://phinx.org/
reference of ruby on rails :
http://edgeguides.rubyonrails.org/active_record_migrations.html#using-the-change-method
cool! like it!
:+1:
:+1: :)
:+1:
#593
:+1: This idea is to reduce the cost of migration in 2 or more times. I know it by own experience. My implementation of this idea in yii2 extension: https://github.com/execut/yii2-migration
Phinx docs about that: http://docs.phinx.org/en/latest/migrations.html
I'd like to make it real later. ;)
I'm not a fan of creating reversible migrations that contain createTable or addColumn.
They might be reversible from a structure perspective, but they lose data.
Of course, if we implemented automated backups of those tables then i'm all for it!