-
Notifications
You must be signed in to change notification settings - Fork 217
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
Set up database connection and create tables #247
Conversation
58834a6
to
b424657
Compare
7eebd26
to
5dfe82e
Compare
d219095
to
f2c65ad
Compare
lib/core/cardano-wallet-core.cabal
Outdated
@@ -46,6 +46,7 @@ library | |||
, generic-lens | |||
, http-api-data | |||
, http-media | |||
, lens |
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.
we use generic-lens
already in codebase. If I remember well, it was decided to use this lens library. probably it is good idea in the last commit to comply with the rest of the code (if possible)
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.
done
lib/core/cardano-wallet-core.cabal
Outdated
, persistent-sqlite | ||
, conduit | ||
, monad-logger | ||
, mtl |
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.
we use transformers
already. probably it is good idea in the last commit to comply with the rest of the code
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.
done
a1efedb
to
ca6be91
Compare
9522984
to
53739ab
Compare
@rvl Please notice that the branch was rebased against |
@paweljakubas Thanks 😄 |
ca6be91
to
a3ec3a6
Compare
4acfcf9
to
aba61e3
Compare
@rvl Please read it before you continue working :
|
-- ^ Database file location, or Nothing for in-memory database | ||
-> IO (DBLayer IO s t) | ||
newDBLayer fp = do | ||
conn <- createSqliteBackend fp logStderr |
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.
wil this logStderr
enable all logs (CREATE_TABLE, INSERT, ...) as a default or errors only? I would give my votes for the second option
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.
indeed, it introduces logs like :
Wallet table
Migrating: CREATE TABLE "wallet"("wallet_id" VARCHAR NOT NULL,"name" VARCHAR NOT NULL,"passphrase_last_updated_at" TIMESTAMP NULL,"status" INTEGER NOT NULL,"delegation" VARCHAR NULL, PRIMARY KEY ("wallet_id"))
CREATE TABLE "wallet"("wallet_id" VARCHAR NOT NULL,"name" VARCHAR NOT NULL,"passphrase_last_updated_at" TIMESTAMP NULL,"status" INTEGER NOT NULL,"delegation" VARCHAR NULL, PRIMARY KEY ("wallet_id")); []
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.
added more customizable logging function (one can choose LogLevel)
W.lastUpdatedAt <$> meta ^. #passphraseInfo | ||
, walTableStatus = meta ^. #status | ||
, walTableDelegation = delegationToText $ meta ^. #delegation | ||
, walTableAddressScheme = Sequential |
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.
This probably has to be addressed in another PR. Either removed or detected whether we are Random or Sequential
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.
Yes there is not yet reading/writing of the wallet state.
However we may even remove this field because the address scheme is fixed by a type parameter of DBLayer.
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.
exactly. This is in line what @KtorZ wrote on slack yesterday:
Then, we'll have one
- external seq wallet layer + seq db layer
- fully owned seq wallet + seq db layer
- fully owned rnd wallet + rnd db layer
Address scheme is set for each db instance. Hence, walTableAddressScheme
is probably superflouous
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.
removed address scheme
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.
LGTM
bors r+ |
Canceled |
fec073b
to
e448eac
Compare
It had an infinite loop.
This will show whether cascading deletes work under sqlite -- once the functions to write other tables are implemented.
Relates to issue #143 and #154
Overview
newDBLayer
function which sets up the db connection and runs migrations.