Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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?



30.0k
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



3.4k

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?