Using incorrect date data type in mysql

Current schema definitions are using timestamp. According to MySQL (https://dev.mysql.com/doc/refman/9.4/en/datetime.html#:~:text=MySQL%20retrieves%20and%20displays%20DATETIME,%3A14%3A07'%20UTC.), this type cannot store dates past 2038-01-19. Any attempt to insert a date in the future this will result in an error or a zero-date, effectively breaking the app logic.

Alter existing tables to change date columns from timestamp to datetime will fix this issue

I have a created a PR to fix this issue: https://github.com/better-auth/better-auth/pull/6366
GitHub
https://dev.mysql.com/doc/refman/9.4/en/datetime.html
MySQL date fields generated as timestamp instead of datetime
DATETIME

Format: YYYY-MM-DD hh:mm:ss
Range: '1000-01-01 00:00:00'...
Was this page helpful?