Skip to content
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

db: Use proper Word64 support #203

Merged
merged 1 commit into from
Jul 24, 2020
Merged

db: Use proper Word64 support #203

merged 1 commit into from
Jul 24, 2020

Conversation

erikd
Copy link
Contributor

@erikd erikd commented Jul 24, 2020

No description provided.

@erikd erikd force-pushed the erikd/persistent-Word64-2 branch 2 times, most recently from 29cac11 to 9af2af9 Compare July 24, 2020 07:29
Previously when the schema used `Word64` as the column type, Persistent
would use `SqlInt64` as the SQL representation which means that `Word64`
values above `maxBound :: Int64` would be stored as negative values in
the database. That is fine for a database only accessed from Haskell but
is a pain in the neck when the database is used as an interop layer for
other languages.

The solution is to define a 'DbWord64' newtype wrapper around 'Word64'
and then map 'DbWord64' to the 'numeric(20,0)' SQL type with a bounds
check.

Closes: #163
@erikd erikd force-pushed the erikd/persistent-Word64-2 branch from 9af2af9 to b629f2f Compare July 24, 2020 07:40
@erikd erikd merged commit a4df8e0 into master Jul 24, 2020
@iohk-bors iohk-bors bot deleted the erikd/persistent-Word64-2 branch July 24, 2020 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant