V
V
Valery Molchanov2016-06-02 23:16:11
Yii
Valery Molchanov, 2016-06-02 23:16:11

How to format 'YEAR' column in yii2 migration?

I create a migration, the column in the database should be of type year(4) and look like this: '2016'.
If you do it like this:

public function up()
    {
        $this->createTable('films', [
...
            'year' => $this->dateTime(),
...
        ]);
    }

then it turns out like this: '0000-00-00 00:00:00'
Tell me, how is it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bearenok, 2016-06-03
@valerik606

'year' => 'year'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question