A
A
Arman2017-02-01 10:16:22
MySQL
Arman, 2017-02-01 10:16:22

Yii2 field type (MySQL) int or timestamp for time?

DD.
All migrations, the yii2 code is mostly focused on INT(). Yes, faster, but harder to use. I started new models on timestamp and "new \yii\db\Expression('NOW()')", now I got two options and it is necessary to inherit and remake half of the Yii code or use int type as they are.
How are you with this? I looked at github, it seems that many remained on int.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-02-01
@Arik

This is an eternal dispute. The truth is that in this or that case one or another format is more convenient, but if the future of the project is vague and unpredictable, it is better to use datetime for dates

D
Dmitry Bay, 2017-02-01
@kawabanga

I started using datetime everywhere. much more convenient in terms of work.
And so, how many people, so many opinions. As for datetime, I first saw it on the forum, and decided to switch from int to it. turned out well.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question