We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Migration generate VARCHAR column types in place of DATE ones

Using Phalcon Devtools 2.0.7 with MySql adapter. MySql Server version: 5.7.9.

The problem impacts on all TIMESTAMP, DATE and DATETIME columns.

Running:

phalcon migration generate --config='.phalcon/config.ini' --migrations='migrations'

Generates this code:

/* ... */

new Column(
    'date_updated',
    array(
        'type' => Column::TYPE_VARCHAR,
        'size' => 1,
        'after' => 'user_id_updated'
    )
),

/* ... */

The correct type should not be Column::TYPE_VARCHAR. It should be Column::TYPE_TIMESTAMP, Column::TYPE_DATE or Column::TYPE_DATETIME.

How can I fix this?



43.9k
Accepted
answer
edited Jan '16

Hi,

what is your phalcon version ?

in 2.0.8 support for timestamp type has been added for migrations: https://github.com/phalcon/cphalcon/releases/tag/phalcon-v2.0.8

Current stable release is 2.0.9 with an "Improved overall support of SQL for migrations": https://github.com/phalcon/cphalcon/releases/tag/phalcon-v2.0.9



12.9k

Hi, after upgrading to 2.0.9 the problem fixed. Now DATE, DATETIME and TIMESTAMP are correctly migrated.

Thank you.

Hi, after upgrading to 2.1.0 still the problem with type TIME and TINYINT. How can I fix this?