Skip to content

Conversation

@ksaric
Copy link
Contributor

@ksaric ksaric commented Jun 12, 2018

https://iohk.myjetbrains.com/youtrack/issue/TSD-39

A read-only implementation of the SQLite DB, still missing the write from web API side, but since this is already a large PR, will fix in another one.

@ksaric ksaric requested review from HirotoShioi and robcohen June 12, 2018 14:17
Copy link
Contributor

@HirotoShioi HirotoShioi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently reviewing. This is first time I've seen sqlite-simple being used so it'll take some time. But implementation seems straight-forward.

test/Spec.hs Outdated
, zlGetTicketInfo = \_ -> pure $ Just ticketInfo
, zlPostTicketComment = \_ -> pure ()
, zlGetTicketComments = \_ -> pure comments
, zlGetAttachment = \_ -> pure mempty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing here.

    • No instance for (Monoid AttachmentContent)
        arising from a use of ‘mempty’

import Database.SQLite.Simple.FromField
import Database.SQLite.Simple.Internal
import Database.SQLite.Simple.Ok
import Database.SQLite.Simple.ToField
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make these imports explicit?


instance FromField TicketId where
fromField (Field (SQLInteger tId) _) = Ok . TicketId . fromIntegral $ tId
fromField f = returnError ConversionFailed f "need a integer, ticket id"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar error. "need an integer, ticket id" . Other error message has same issues as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I remember I read somewhere they can be interchanged, but it doesn't seem to be so - https://www.quickanddirtytips.com/education/grammar/a-versus-an

TicketTags (..), TicketURL (..), UserId (..), ZendeskLayer (..))


-- https://ocharles.org.uk/blog/posts/2014-08-07-postgresql-simple-generic-sop.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what does meant. I read the article and it seems like you can remove all these typeclass definitions. Is this for the future task?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is why I pasted it here.

@HirotoShioi
Copy link
Contributor

Also, I'm not really sure how we're going to utilize user datatype but I guess that'll be clarified in the next PR

@HirotoShioi
Copy link
Contributor

We should add *.db (or create db folder then ignore that file?) to the .gitignore so we don't accidentally upload prod.db to github by mistake.

@ksaric
Copy link
Contributor Author

ksaric commented Jun 13, 2018

*.db will be created in the next PR along with the git ignore rule. The rest is ok.

@ksaric ksaric changed the title [TSD-39] [TSD-39] Caching using a simple SQLite database Jun 13, 2018
Copy link
Contributor

@robcohen robcohen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any issues in this PR.

@ksaric ksaric merged commit 378bfea into develop Jun 14, 2018
@ksaric ksaric deleted the ksaric/TSD-39 branch June 26, 2018 10:50
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.

4 participants