-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fixing posgres datetime and timestamp column created with wrong format #4578
Conversation
Doesn't this change default values and hence is a breaking change? |
Isn't this still a breaking change, as it will invert values set by users already? |
@kibertoad sorry the naming of variables was bad. Yeah i think so. I can change it so that it is not a breaking change anymore. I don't know why but when i was doing it i thought it look cleaner since postgres has tz true as default |
It is cleaner, yes, just a bit too late to change it, would require a semver major and still likely to break stuff for people who don't read docs. |
tableSql = client | ||
.schemaBuilder() | ||
.table('users', (table) => { | ||
table.datetime('foo', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing some context since I'm not familiar with the code base, but wouldn't passing false
here result in timestamp WITHOUT timezone? Why does it seem inverted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing false
there would result in timestamptz because :
-
This is the original design which can accept:
-
And this is the original test for timestamp() which do the same thing as datetime()
The test that you see is just the one i added for datetime. I did changed it to withTz so it does not seem inverted anymore. But as @kibertoad said, it will cause breaking change for people who had already done it the original way so i just added the bug fix and sometest without changing the parameter. Maybe we could request this as feature for future update because i agree that it is not intuiitive.
@kibertoad I changed it so it fixed the bug without making breaking changes. Is there any other change that i need to do? |
Thank you! |
Why:
See issue Not passing useTz in datetime column creation results in "datetime without timezone #4577
How: