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

feat(sqlite): automatic path provision for 'options.storage' #11853

Merged
merged 6 commits into from Jan 22, 2020

Conversation

@multum
Copy link
Contributor

multum commented Jan 21, 2020

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Closes #11663

@multum multum requested a review from papb Jan 21, 2020
@codecov

This comment has been minimized.

Copy link

codecov bot commented Jan 21, 2020

Codecov Report

Merging #11853 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11853   +/-   ##
=======================================
  Coverage   96.27%   96.27%           
=======================================
  Files          94       94           
  Lines        9209     9209           
=======================================
  Hits         8866     8866           
  Misses        343      343
Impacted Files Coverage Δ
lib/associations/belongs-to-many.js 98.07% <ø> (ø) ⬆️
lib/model.js 96.54% <100%> (ø) ⬆️
lib/dialects/mariadb/data-types.js 100% <100%> (ø) ⬆️
lib/dialects/postgres/data-types.js 96.26% <100%> (ø) ⬆️
lib/query-interface.js 92.19% <100%> (ø) ⬆️
lib/dialects/mysql/data-types.js 98.43% <100%> (ø) ⬆️
lib/dialects/abstract/query-generator.js 97.02% <100%> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53200c8...27dfeac. Read the comment docs.

multum added 2 commits Jan 21, 2020
Copy link
Member

papb left a comment

Nice work, just a few refactor requests :)

lib/dialects/sqlite/connection-manager.js Outdated Show resolved Hide resolved
lib/dialects/sqlite/connection-manager.js Outdated Show resolved Hide resolved
test/integration/configuration.test.js Outdated Show resolved Hide resolved
@papb papb changed the title fix(sqlite): added automatic path provision for 'options.storage' feat(sqlite): automatic path provision for 'options.storage' Jan 22, 2020
@papb
papb approved these changes Jan 22, 2020
@papb

This comment has been minimized.

Copy link
Member

papb commented Jan 22, 2020

Great work!

@papb papb merged commit cfc9685 into sequelize:master Jan 22, 2020
4 checks passed
4 checks passed
codecov/patch 100% of diff hit (target 96.27%)
Details
codecov/project 96.27% (+0%) compared to 53200c8
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@@ -1,5 +1,7 @@
'use strict';

const path = require('path');
const jetpack = require('fs-jetpack');

This comment has been minimized.

Copy link
@sushantdhiman

sushantdhiman Jan 23, 2020

Member

Do we really need to use this new library, its unpacked size is ~300KB

This comment has been minimized.

Copy link
@multum

multum Jan 23, 2020

Author Contributor

@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:

  1. Return the fs-jetpack package back to devDependencies and use it only for the convenience of writing tests
  2. Write my own function(similar to jetpack.dir()) to automatically provide the path for sqlite.options.storage

This comment has been minimized.

Copy link
@sushantdhiman

sushantdhiman Jan 23, 2020

Member

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

This comment has been minimized.

Copy link
@multum

multum Jan 23, 2020

Author Contributor

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?

This comment has been minimized.

Copy link
@sushantdhiman

sushantdhiman Jan 23, 2020

Member

That will be great @multum

This comment has been minimized.

Copy link
@papb

papb Jan 23, 2020

Member

Oops, nice catch @sushantdhiman, sorry about that.

@multum multum mentioned this pull request Jan 23, 2020
4 of 6 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.