-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(sqlite): automatic path provision for 'options.storage' #11853
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11853 +/- ##
=======================================
Coverage 96.27% 96.27%
=======================================
Files 94 94
Lines 9209 9209
=======================================
Hits 8866 8866
Misses 343 343
Continue to review full report at Codecov.
|
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 work, just a few refactor requests :)
Great work! |
@@ -1,5 +1,7 @@ | |||
'use strict'; | |||
|
|||
const path = require('path'); | |||
const jetpack = require('fs-jetpack'); |
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.
Do we really need to use this new library, its unpacked size is ~300KB
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.
@sushantdhiman You're right. This package greatly simplifies the work with the file system, makes the code more concise. In addition, sequelize
included it as devDependency
. But I did not pay attention to its size. This in my opinion is not critical on the server side, but due to the fact that the file system is used by the sequelize
only in ~ one place, I would like to do the following:
- Return the
fs-jetpack
package back todevDependencies
and use it only for the convenience of writing tests - Write my own function(similar to
jetpack.dir()
) to automatically provide the path forsqlite.options.storage
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.
It is only used for creating a path jetpack.dir(path.dirname(options.storage))
, right? With Node 10 mkdirSync
supports this https://nodejs.org/docs/latest-v10.x/api/fs.html#fs_fs_mkdirsync_path_options
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.
Awesome! Since sequelize
6.x will support node version 10 and more, we can actually use fs.mkdir(path, { recursive: true })
. Can I do a pull request?
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.
That will be great @multum
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.
Oops, nice catch @sushantdhiman, sorry about that.
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Closes #11663