Just to help with others facing similar questions, I've sorted out how to work with the dev-tools and migrations (at least for my purposes).
NOTE: Switching to the 3.0.x branch did help. I found at least 2 bugs in the master branch that were fixed in 3.0.x (unfortunately, I found them after I had applied my own fixes).
Generate time-based migration versions
To create time-based migration versions make sure you generate your migrations with the --descr=s
option. Your description will be used at the end of a generated folder name, e.g. 1479865560862257_init
, for your new migration set. If you leave off the --descr
option, the default versioning will be used. It is important to realize that you will need to use the --descr
option every time you call phalcon migration generate
as it will revert to the default reversioning scheme if you don't.
Example: phalcon migration generate --descr=init
Run time-based migrations
To run your time-based migrations, you need to use the --ts-based
option on your migration run. Again, you will need to do this every time or the script will complain that it could not find any migrations to run.
Example: phalcon migration run --ts-based
Remember your settings
The documentation doesn't tell you, but you can put some settings into your config file that will make things easier. If you set migrationsTsBased
to true
, phalcon dev-tools will pick it up and you will not have to remember to include the options every time. While I was happy to find this, it was not posted anywhere in an obvious, easy to find way. I was getting ready to re-invent the wheel when I found it in the code. I currently have this in a config.ini and it seems to work fine:
[database]
adapter = Mysql
host = localhost
username = <username>
password = <password>
dbname = <database_name>
[application]
migrationsTsBased = true
logInDb = true
Of course, you will need to set your databse connection properties for your system. The logInDb
option tells the dev-tools to log the migrations in the databse for me. It is equivalent to using --log-in-db
on the command line.
I hope this helps others avoid some unnecessary woes :-)