-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Datetime should be mapped to timesamp "with time zone" instead of "without time zone" #12
Comments
Did you missed the repo? You're talking about MySQL but this is the pg repo and not MySQL. But generally we're always open for PRs though.
Yes, timestampt is actually a type, with timezone is just an option and thus not the mapping should resolve to this, but it would make sense to have the option to enable this. And I guess you mean: Then again, this is the postgres driver If you want to open a PR adding the option to add |
No I'm on the right repo. I just took MySQL as an example for this issue but I use PG. And I know that In MySQL there is a difference between But, in this repo, there is no difference between So I suggest to map I'm not sure it's a good idea to add a new option. If it's the only solution, it should be done in |
Sry, I hope this answer is not too long...
That is not true entirely. Options that do not exist on other dbs, just get dropped, see for example the constraints, there are already some, that do only apply to some dbs. And on the other side: There is no way to be completely But to come back to the main topic:
Yes it is a good idea as this is driver specific and does not apply globally, but it is not a good idea to map the datatype to something not matching the expectations anymore. And that is actually something you currently ask for: Changing a datatype to something that is not anymore just a datatype. And this can't and wont be done for multiple reasons.To just call out the most significant one: It is not that I do not understand what you're thinking of or that I think that genericity is bad, but it is very limited to a certain point. As soon as you actually want to use something, that is specific, you can't really bind yourself to those limits anymore. I personally always see genericity as a side goal of migrations. Genericity does on the one hand allow to switch over to another database way easier and on the other hand it can allow to quite easily write migrations for multiple target dbs, but just with limitations. As soon as you pass those limitations, you need to put some extra efforts, to make those usable on other databases, as said earlier: Everything comes with a trade off. And in this case you made the comparison with MySQL, but this is not a good candidate to compare against. There are so many different DBs out there, therefore it does not make sense to compare them in that way. But what we actually can do is to take the actual ANSI SQL Standard, also to mention that this doesn't really apply to migrations as we also handle NoSQL DBs, and the Standard don't make a difference actually:
And:
Source: So in a short version: We can't do this as this would:
|
Ok I think I understand your point of view. Thanks for the (long) explanation 😉 So I tried to use Do you think it's good idea to stay like this ? Or should I add an option with another method ? I don't see any way to do something like this in the doc of column specs. |
This just tells you: Hey, you're using something custom, be aware of that fact. That is nothing negative though.
I think, it would be better to use the normal datatype and add the possibility to specify options for that datatype. This is something that is planned anyway though. Especially for datatypes like |
#17 add support for column specs |
Hi, there is currently no way to create a column with the type
timestamp with time zone
.When I look into the code I found that
datetime
is mapped totimestamp
. So no matter if I define atimestamp
or adatetime
I will have atimezone
.In the MySQL documentation for
DATETIME
you can see that this type of column takes care of local time zone.Is there something wrong to map
datetime
totimestamp with time zone
?I tried to update the mapping locally and all work fine for me. Do you see any issue doing this ?
If not I can submit a PR with these changes.
Thanks.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: