-
Notifications
You must be signed in to change notification settings - Fork 88
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
Update to crystal 0.25.0 #228
Conversation
@faustinoaq We probably should also address other changes specified in #226. |
- Postgres IDs don't reset when a table is truncated, so matching on explicit ID is unreliable.
I believe this addresses all breaking changes for Granite to update to 0.25. This represents a catastrophic breaking change for anyone using sqlite.Sqlite, Mysql, Postgres all handle storing datetimes differently, and Crystal has changed the way it handles this stuff. Fun times. The updates to the time code are basically:
cc @drujensen @damianham (I believe you've dealt with sqlite timestamps in the past?) |
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.
@robacarp yes, I just disabled the timestamps to handle sqlite. It is a pita :-/
@@ -23,7 +23,7 @@ module Granite::Querying | |||
if @@adapter.class.name == "Granite::Adapter::Sqlite" | |||
# sqlite3 does not have timestamp type - timestamps are stored as str | |||
# will break for null timestamps | |||
self.\{{name.id}} = Time.parse(result.read(String), "%F %X" ) | |||
self.\{{name.id}} = Time.parse(result.read(String), Granite::DATETIME_FORMAT) |
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.
nice change to Granite::DATETIME_FORMAT
💯
why not rescue the exception for existing time strings and try to parse with "%F %X" ? |
Interesting idea, Would this solve the SQLite issue? |
I think this might work with one caveat: We either need to store the time as UTC as a convention or we need to include the timezone in the stored string. You should always store the timezone implicitly or explicitly to get the right results. I prefer we store the timezone in the string explicitly. The advantage is you can determine the timezone that was originally used by the client/server when it was originally stored. If you convert it to UTC before storing, you lose that information. |
I agree, it makes sense for Granite to store the timezone as provided in the Time object given. In the event that it makes more sense for an application timezone to always be UTC, the appdev can make that happen easy enough. |
Minimally addresses issues required to update Granite to Crystal 0.25.0
crystal deps
is being removed. CLI: remove deps command crystal-lang/crystal#5544JSON::Type
. Implement JSON::Any and YAML::Any without recursive aliases crystal-lang/crystal#5183File.stat
is renamed toFile.info
Rename and rework File::Stat as File::Info crystal-lang/crystal#5584Time::Kind
to use the newTime::Location
insteadRead the changelog for anything I missed. https://github.com/bcardiff/crystal/blob/changelog/0.25.0/CHANGELOG.md
Fixes #226