You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the CreateDateColumn decorator in TypeORM with MySQL and NestJS, setting CURRENT_TIMESTAMP or CURRENT_TIMESTAMP(0) as the default value results in Invalid default value error. However, setting the default value as CURRENT_TIMESTAMP(6) or providing a precision: 0 option with CURRENT_TIMESTAMP doesn't throw any error.
Expected Behavior
Using CURRENT_TIMESTAMP or CURRENT_TIMESTAMP(0) as default values in CreateDateColumn decorator should not result in an error when synchronizing the database schema.
Actual Behavior
When using CURRENT_TIMESTAMP or CURRENT_TIMESTAMP(0) as default values in CreateDateColumn decorator, an error occurs when synchronizing the database schema:
QueryFailedError: Invalid default value for 'createdAt'
Steps to reproduce
Here are the entity definitions that cause the issue:
Issue description
When using the CreateDateColumn decorator in TypeORM with MySQL and NestJS, setting CURRENT_TIMESTAMP or CURRENT_TIMESTAMP(0) as the default value results in Invalid default value error. However, setting the default value as CURRENT_TIMESTAMP(6) or providing a precision: 0 option with CURRENT_TIMESTAMP doesn't throw any error.
Expected Behavior
Using CURRENT_TIMESTAMP or CURRENT_TIMESTAMP(0) as default values in CreateDateColumn decorator should not result in an error when synchronizing the database schema.
Actual Behavior
When using CURRENT_TIMESTAMP or CURRENT_TIMESTAMP(0) as default values in CreateDateColumn decorator, an error occurs when synchronizing the database schema:
Steps to reproduce
Here are the entity definitions that cause the issue:
My Environment
Additional Context
Using CURRENT_TIMESTAMP in combination with precision: 0 doesn't result in any error:
I would greatly appreciate any insights or workarounds for this issue. This report was composed with the help of an AI Assistant.
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered: