Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration #2

Open
Valkinaz opened this issue Apr 3, 2018 · 3 comments
Open

Migration #2

Valkinaz opened this issue Apr 3, 2018 · 3 comments

Comments

@Valkinaz
Copy link

Valkinaz commented Apr 3, 2018

Hello.
Migration m160703_001232_initStateMachineMigrations has a problem with table sm_timeout column expires_at.

Exception 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'expires_at'

@ptheofan
Copy link
Owner

ptheofan commented Apr 3, 2018

Hey man,

this is a legit value for mysql/mariadb timestamp columns.
https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html

Issue might be sql strict mode setting or mysql version you are using.
The following link might help you solve it in your installation.
https://stackoverflow.com/questions/36374335/error-in-mysql-when-setting-default-value-for-date-or-datetime/40075057

@Valkinaz
Copy link
Author

Valkinaz commented Apr 4, 2018

Yes, it is strict mode.
But why we need to set non-existent date as default value?
I think NULL will be better or maybe CURRENT_TIMESTAMP?

@ptheofan
Copy link
Owner

The current timestamp will not work as it would instantly expire the row. Setting null is an option and will require some updates in the code. Code contributions are most welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants