We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Dev Tools Migrations / phalcon DBO and timestamps in schemas

Hi all,

I'm fairly new to Phalcon but I'm building a multi-module app with a fairly involved database.

I was excited to see that phalcon dev-tools had functions to generate database migrations and manage version control but I'm having some trouble getting the functionality I'd like out of it and the documentation seems a little limited.

Question #1 - When I run a migration on a database table that I have a column setup as a timestamp and update to current timestamp on, the devtools migration produces a class with code that doesn't reflect the mysql schema. The column ends up as type 'date'. In fact there seems to be no TIMESTAMP attribute for type of column in migrations or in db/pdo/mysql. I was hoping to generate table structure with createtable of pdo/mysql and keep track of it with migrations - but it seems the code won't allow for timestamp columns (or other special attributes?) in the schema?

Am I missing something here?

Question #2 - Assuming that I get migrations sorted - is it possible to set WHICH database to migrate to? By that I mean what if an app has several databases on the same server (separate clients). Migrations seem to just go with the default config db connection and there doesn't appear to be a way to set this with a comand line option. Is this possible with the config fle option in the command line? And what would the syntax look like?

Thanks for any help on either of these 2 questions!



I'd like to know the same thing. I'm actually using Percona 5.6, so I would like to take it one step further and have a column that could take CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.