-
Notifications
You must be signed in to change notification settings - Fork 2.3k
@truffle/db Option to save .db directory to project directory #4503
Conversation
It looks like this PR modifies the project-level config, where we ideally want to save users the trouble of configuring this on a per-project basis... instead I think we want this to be a user-level config option. Happy to explain more in our next call. |
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.
few minor things. thanks for taking this on!
packages/db/README.md
Outdated
@@ -33,7 +33,8 @@ Add the following to your `truffle-config.js` file in order to enable Truffle DB | |||
|
|||
``` | |||
db: { | |||
enabled: true | |||
enabled: true, | |||
saveLocally: true // Optional - save the .db directory to the project directory. Default: false. |
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 shouldn't be in this example anymore, since we've moved this option from truffle-config over to the user-level config
|
@cds-amal You got it, thanks for taking a look. |
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.
Looks good! Just one remaining comment about the README. Thanks @tenthirtyone!
Note: Enabling Truffle DB does not affect artifacts, but will produce a new `.db` | ||
directory when you compile or migrate your project. | ||
|
||
Add the following to your user truffle config (`~/.config/truffle-nodejs/config.json`) to enable saving the `.db` directory to your project directory |
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.
So there's some infrastructure for doing this automatically via truffle config set <...>
. I forget the exact syntax; @eggplantzzz or @cds-amal do you remember offhand?
In any event, we probably want to recommend that approach rather than forcing users to find this file and edit it manually - since the path differs based on OS (Mac will use ~/Library/Application\ Support/truffle-nodejs
, for instance)
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.
Oh fantastic.
I wasn't aware of the convenience command. I can probably drill down - packages/core/lib/commands/config.js
(but wouldn't mind the exact syntax).
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.
Unfortunately the infrastructure isn't quite there yet
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.
Maybe we need to do a separate PR to get this TODO addressed, and then rebase this once that's merged?
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.
I can jump over to tackle it since it's all connected.
Closing and making it part of #4680 |
Summary
Adds the
saveLocally
property to thedb
section of thetruffle-config.js
When enabled, the db adapters will return the working directory as the location to save the
.db
folder.To Test
truffle-config.js
.ER:
.db
directory exists in~/.config/truffle-nodejs/
(@truffle/configgetTruffleDataDirectory()
)saveLocally
config flag above with the already enabled db flag.ER:
.db
directory exists in your truffle project directory (@truffle/configdetect().working_directory
)Closes #4495