From 011c8e631e34d0dee5102c4b39cf747a4935bf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Adem=20I=C5=9EIKLI?= Date: Fri, 9 Sep 2022 10:07:05 +0300 Subject: [PATCH 1/5] Fixed --- test/sqlite.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sqlite.spec.ts b/test/sqlite.spec.ts index c097092..fbd681b 100644 --- a/test/sqlite.spec.ts +++ b/test/sqlite.spec.ts @@ -9,7 +9,7 @@ describe('sqlite', () => { before(() => { database = knex({ - client: 'sqlite3', + client: 'better-sqlite3', connection: { filename: './test/db/sqlite.db', }, From 51db82efd976f66ebeaa8d0bf1dac8c84d466bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Adem=20I=C5=9EIKLI?= Date: Fri, 9 Sep 2022 10:14:33 +0300 Subject: [PATCH 2/5] Added missing dependencies --- package-lock.json | 566 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 567 insertions(+) diff --git a/package-lock.json b/package-lock.json index 90565da..fba681d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@types/lodash.isnil": "^4.0.7", "@types/mocha": "^9.1.1", "@types/node": "^17.0.41", + "better-sqlite3": "^7.6.2", "chai": "^4.3.6", "husky": "^8.0.1", "knex": "^2.1.0", @@ -709,6 +710,17 @@ } ] }, + "node_modules/better-sqlite3": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.6.2.tgz", + "integrity": "sha512-S5zIU1Hink2AH4xPsN0W43T1/AJ5jrPh7Oy07ocuW/AKYYY02GWzz9NH0nbSMn/gw6fDZ5jZ1QsHt1BXAwJ6Lg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.0" + } + }, "node_modules/bignumber.js": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", @@ -727,6 +739,15 @@ "node": ">=8" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bl": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", @@ -1179,6 +1200,21 @@ "node": ">=10" } }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -1191,6 +1227,15 @@ "node": ">=0.12" } }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -1280,6 +1325,15 @@ "iconv-lite": "^0.6.2" } }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -1422,6 +1476,21 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1470,6 +1539,12 @@ "node": ">= 6" } }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "node_modules/fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -1630,6 +1705,12 @@ "integrity": "sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA==", "dev": true }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "dev": true + }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -1910,6 +1991,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "node_modules/internal-slot": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", @@ -2766,6 +2853,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -2891,6 +2990,12 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, "node_modules/mocha": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", @@ -3013,6 +3118,12 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", + "dev": true + }, "node_modules/native-duplexpair": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/native-duplexpair/-/native-duplexpair-1.0.0.tgz", @@ -3029,6 +3140,18 @@ "node": ">= 0.6" } }, + "node_modules/node-abi": { + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.24.0.tgz", + "integrity": "sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==", + "dev": true, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-abort-controller": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.0.1.tgz", @@ -3548,6 +3671,32 @@ "node": ">=0.10.0" } }, + "node_modules/prebuild-install": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", + "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "dev": true, + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prettier": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", @@ -3605,6 +3754,16 @@ "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true }, + "node_modules/pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -3623,6 +3782,30 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -3871,6 +4054,51 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/slice-ansi": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", @@ -4199,6 +4427,89 @@ "node": ">= 10" } }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/tar-stream/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/tar/node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -4370,6 +4681,18 @@ "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -5260,6 +5583,16 @@ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, + "better-sqlite3": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.6.2.tgz", + "integrity": "sha512-S5zIU1Hink2AH4xPsN0W43T1/AJ5jrPh7Oy07ocuW/AKYYY02GWzz9NH0nbSMn/gw6fDZ5jZ1QsHt1BXAwJ6Lg==", + "dev": true, + "requires": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.0" + } + }, "bignumber.js": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", @@ -5272,6 +5605,15 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", @@ -5610,6 +5952,15 @@ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "requires": { + "mimic-response": "^3.1.0" + } + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -5619,6 +5970,12 @@ "type-detect": "^4.0.0" } }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, "define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -5690,6 +6047,15 @@ "iconv-lite": "^0.6.2" } }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -5796,6 +6162,18 @@ "strip-final-newline": "^3.0.0" } }, + "expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "dev": true + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -5832,6 +6210,12 @@ "mime-types": "^2.1.12" } }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, "fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -5946,6 +6330,12 @@ "integrity": "sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA==", "dev": true }, + "github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "dev": true + }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -6143,6 +6533,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "internal-slot": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", @@ -6772,6 +7168,12 @@ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", "dev": true }, + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -6868,6 +7270,12 @@ "minimist": "^1.2.5" } }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, "mocha": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", @@ -6963,6 +7371,12 @@ "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", "dev": true }, + "napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", + "dev": true + }, "native-duplexpair": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/native-duplexpair/-/native-duplexpair-1.0.0.tgz", @@ -6976,6 +7390,15 @@ "dev": true, "optional": true }, + "node-abi": { + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.24.0.tgz", + "integrity": "sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==", + "dev": true, + "requires": { + "semver": "^7.3.5" + } + }, "node-abort-controller": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.0.1.tgz", @@ -7354,6 +7777,26 @@ "xtend": "^4.0.0" } }, + "prebuild-install": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", + "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "dev": true, + "requires": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + } + }, "prettier": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz", @@ -7396,6 +7839,16 @@ "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", "dev": true }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -7411,6 +7864,26 @@ "safe-buffer": "^5.1.0" } }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true + } + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -7604,6 +8077,23 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true + }, + "simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "dev": true, + "requires": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "slice-ansi": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", @@ -7849,6 +8339,73 @@ } } }, + "tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + }, + "dependencies": { + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + } + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "tarn": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz", @@ -7972,6 +8529,15 @@ "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", "dev": true }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", diff --git a/package.json b/package.json index 0220222..cef3002 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@types/lodash.isnil": "^4.0.7", "@types/mocha": "^9.1.1", "@types/node": "^17.0.41", + "better-sqlite3": "^7.6.2", "chai": "^4.3.6", "husky": "^8.0.1", "knex": "^2.1.0", From 4f9b35475728c894614c106ea2a260357c40bfd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Adem=20I=C5=9EIKLI?= Date: Fri, 9 Sep 2022 10:20:20 +0300 Subject: [PATCH 3/5] Fixed better-sqlite bug --- lib/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/index.ts b/lib/index.ts index 61ac0de..53de8fd 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -16,6 +16,7 @@ export function SchemaInspector(knex: Knex) { constructor = require('./dialects/cockroachdb').default; break; case 'Client_SQLite3': + case 'Client_BetterSQLite3': constructor = require('./dialects/sqlite').default; break; case 'Client_Oracledb': From 82eb4a120965c99de48a4647e1d65647b66bdb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Adem=20I=C5=9EIKLI?= Date: Sun, 11 Sep 2022 11:00:01 +0300 Subject: [PATCH 4/5] Fixed sqlite tests --- test/sqlite.spec.ts | 1090 ++++++++++++++++++++++--------------------- 1 file changed, 548 insertions(+), 542 deletions(-) diff --git a/test/sqlite.spec.ts b/test/sqlite.spec.ts index fbd681b..c48b5d9 100644 --- a/test/sqlite.spec.ts +++ b/test/sqlite.spec.ts @@ -3,564 +3,570 @@ import { expect } from 'chai'; import schemaInspector from '../lib'; import { SchemaInspector } from '../lib/types/schema-inspector'; -describe('sqlite', () => { - let database: Knex; - let inspector: SchemaInspector; +describe('sqlite test suite', function () { + const data = ['sqlite3', 'better-sqlite3']; - before(() => { - database = knex({ - client: 'better-sqlite3', - connection: { - filename: './test/db/sqlite.db', - }, - }); - inspector = schemaInspector(database); - }); + data.forEach(function (clientType) { + describe(clientType, () => { + let database: Knex; + let inspector: SchemaInspector; - after(async () => { - await database.destroy(); - }); + before(() => { + database = knex({ + client: clientType, + connection: { + filename: './test/db/sqlite.db', + }, + }); + inspector = schemaInspector(database); + }); - describe('.tables', () => { - it('returns tables', async () => { - expect(await inspector.tables()).to.deep.equal([ - 'page_visits', - 'users', - 'teams', - ]); - }); - }); + after(async () => { + await database.destroy(); + }); - describe('.tableInfo', () => { - it('returns information for all tables', async () => { - expect(await inspector.tableInfo()).to.deep.equal([ - { - name: 'page_visits', - sql: - 'CREATE TABLE page_visits (\n' + - ' request_path varchar(100)\n' + - ', user_agent varchar(200)\n' + - ', created_at datetime\n' + - ')', - }, - { - name: 'users', - sql: - 'CREATE TABLE "users" (\n' + - '\t"id"\tINTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n' + - '\t"team_id"\tinteger NOT NULL,\n' + - '\t"email"\tvarchar(100),\n' + - '\t"password"\tvarchar(60),\n' + - `\t"status"\tvarchar(60) DEFAULT 'active',\n` + - '\tFOREIGN KEY("team_id") REFERENCES "teams"("id") ' + - 'ON UPDATE CASCADE ' + - 'ON DELETE CASCADE\n' + - ')', - }, - { - name: 'teams', - sql: - 'CREATE TABLE "teams" (\n' + - '\t"id"\tINTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n' + - '\t"uuid"\tvarchar(36) NOT NULL UNIQUE,\n' + - '\t"name"\tvarchar(100) DEFAULT NULL,\n' + - '\t"description"\ttext,\n' + - '\t"credits"\tinteger,\n' + - '\t"created_at"\tdatetime,\n' + - '\t"activated_at"\tdate\n' + - ')', - }, - ]); - }); + describe('.tables', () => { + it('returns tables', async () => { + expect(await inspector.tables()).to.deep.equal([ + 'page_visits', + 'users', + 'teams', + ]); + }); + }); - it('returns information for specific table', async () => { - expect(await inspector.tableInfo('teams')).to.deep.equal({ - name: 'teams', - sql: - 'CREATE TABLE "teams" (\n' + - '\t"id"\tINTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n' + - '\t"uuid"\tvarchar(36) NOT NULL UNIQUE,\n' + - '\t"name"\tvarchar(100) DEFAULT NULL,\n' + - '\t"description"\ttext,\n' + - '\t"credits"\tinteger,\n' + - '\t"created_at"\tdatetime,\n' + - '\t"activated_at"\tdate\n' + - ')', + describe('.tableInfo', () => { + it('returns information for all tables', async () => { + expect(await inspector.tableInfo()).to.deep.equal([ + { + name: 'page_visits', + sql: + 'CREATE TABLE page_visits (\n' + + ' request_path varchar(100)\n' + + ', user_agent varchar(200)\n' + + ', created_at datetime\n' + + ')', + }, + { + name: 'users', + sql: + 'CREATE TABLE "users" (\n' + + '\t"id"\tINTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n' + + '\t"team_id"\tinteger NOT NULL,\n' + + '\t"email"\tvarchar(100),\n' + + '\t"password"\tvarchar(60),\n' + + `\t"status"\tvarchar(60) DEFAULT 'active',\n` + + '\tFOREIGN KEY("team_id") REFERENCES "teams"("id") ' + + 'ON UPDATE CASCADE ' + + 'ON DELETE CASCADE\n' + + ')', + }, + { + name: 'teams', + sql: + 'CREATE TABLE "teams" (\n' + + '\t"id"\tINTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n' + + '\t"uuid"\tvarchar(36) NOT NULL UNIQUE,\n' + + '\t"name"\tvarchar(100) DEFAULT NULL,\n' + + '\t"description"\ttext,\n' + + '\t"credits"\tinteger,\n' + + '\t"created_at"\tdatetime,\n' + + '\t"activated_at"\tdate\n' + + ')', + }, + ]); + }); + + it('returns information for specific table', async () => { + expect(await inspector.tableInfo('teams')).to.deep.equal({ + name: 'teams', + sql: + 'CREATE TABLE "teams" (\n' + + '\t"id"\tINTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n' + + '\t"uuid"\tvarchar(36) NOT NULL UNIQUE,\n' + + '\t"name"\tvarchar(100) DEFAULT NULL,\n' + + '\t"description"\ttext,\n' + + '\t"credits"\tinteger,\n' + + '\t"created_at"\tdatetime,\n' + + '\t"activated_at"\tdate\n' + + ')', + }); + }); }); - }); - }); - describe('.hasTable', () => { - it('returns if table exists or not', async () => { - expect(await inspector.hasTable('teams')).to.equal(true); - expect(await inspector.hasTable('foobar')).to.equal(false); - }); - }); + describe('.hasTable', () => { + it('returns if table exists or not', async () => { + expect(await inspector.hasTable('teams')).to.equal(true); + expect(await inspector.hasTable('foobar')).to.equal(false); + }); + }); - describe('.columns', () => { - it('returns information for all tables', async () => { - expect(await inspector.columns()).to.have.deep.members([ - { table: 'page_visits', column: 'request_path' }, - { table: 'page_visits', column: 'user_agent' }, - { table: 'page_visits', column: 'created_at' }, - { table: 'teams', column: 'id' }, - { table: 'teams', column: 'uuid' }, - { table: 'teams', column: 'name' }, - { table: 'teams', column: 'description' }, - { table: 'teams', column: 'credits' }, - { table: 'teams', column: 'created_at' }, - { table: 'teams', column: 'activated_at' }, - { table: 'users', column: 'id' }, - { table: 'users', column: 'team_id' }, - { table: 'users', column: 'email' }, - { table: 'users', column: 'password' }, - { table: 'users', column: 'status' }, - ]); - }); + describe('.columns', () => { + it('returns information for all tables', async () => { + expect(await inspector.columns()).to.have.deep.members([ + { table: 'page_visits', column: 'request_path' }, + { table: 'page_visits', column: 'user_agent' }, + { table: 'page_visits', column: 'created_at' }, + { table: 'teams', column: 'id' }, + { table: 'teams', column: 'uuid' }, + { table: 'teams', column: 'name' }, + { table: 'teams', column: 'description' }, + { table: 'teams', column: 'credits' }, + { table: 'teams', column: 'created_at' }, + { table: 'teams', column: 'activated_at' }, + { table: 'users', column: 'id' }, + { table: 'users', column: 'team_id' }, + { table: 'users', column: 'email' }, + { table: 'users', column: 'password' }, + { table: 'users', column: 'status' }, + ]); + }); - it('returns information for specific table', async () => { - expect(await inspector.columns('teams')).to.have.deep.members([ - { column: 'id', table: 'teams' }, - { column: 'uuid', table: 'teams' }, - { column: 'name', table: 'teams' }, - { column: 'description', table: 'teams' }, - { column: 'credits', table: 'teams' }, - { column: 'created_at', table: 'teams' }, - { column: 'activated_at', table: 'teams' }, - ]); - }); - }); + it('returns information for specific table', async () => { + expect(await inspector.columns('teams')).to.have.deep.members([ + { column: 'id', table: 'teams' }, + { column: 'uuid', table: 'teams' }, + { column: 'name', table: 'teams' }, + { column: 'description', table: 'teams' }, + { column: 'credits', table: 'teams' }, + { column: 'created_at', table: 'teams' }, + { column: 'activated_at', table: 'teams' }, + ]); + }); + }); - describe('.columnInfo', () => { - it('returns information for all columns in all tables', async () => { - expect(await inspector.columnInfo()).to.have.deep.members([ - { - name: 'request_path', - table: 'page_visits', - data_type: 'varchar', - default_value: null, - max_length: 100, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'user_agent', - table: 'page_visits', - data_type: 'varchar', - default_value: null, - max_length: 200, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'created_at', - table: 'page_visits', - data_type: 'datetime', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'id', - table: 'teams', - data_type: 'integer', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: false, - is_primary_key: true, - has_auto_increment: true, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'uuid', - table: 'teams', - data_type: 'varchar', - default_value: null, - max_length: 36, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: true, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'name', - table: 'teams', - data_type: 'varchar', - default_value: null, - max_length: 100, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'description', - table: 'teams', - data_type: 'text', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'credits', - table: 'teams', - data_type: 'integer', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'created_at', - table: 'teams', - data_type: 'datetime', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'activated_at', - table: 'teams', - data_type: 'date', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'id', - table: 'users', - data_type: 'integer', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: false, - is_primary_key: true, - has_auto_increment: true, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'team_id', - table: 'users', - data_type: 'integer', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: 'id', - foreign_key_table: 'teams', - }, - { - name: 'email', - table: 'users', - data_type: 'varchar', - default_value: null, - max_length: 100, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'password', - table: 'users', - data_type: 'varchar', - default_value: null, - max_length: 60, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'status', - table: 'users', - data_type: 'varchar', - default_value: 'active', - max_length: 60, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - ]); - }); + describe('.columnInfo', () => { + it('returns information for all columns in all tables', async () => { + expect(await inspector.columnInfo()).to.have.deep.members([ + { + name: 'request_path', + table: 'page_visits', + data_type: 'varchar', + default_value: null, + max_length: 100, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'user_agent', + table: 'page_visits', + data_type: 'varchar', + default_value: null, + max_length: 200, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'created_at', + table: 'page_visits', + data_type: 'datetime', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'id', + table: 'teams', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: false, + is_primary_key: true, + has_auto_increment: true, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'uuid', + table: 'teams', + data_type: 'varchar', + default_value: null, + max_length: 36, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: true, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'name', + table: 'teams', + data_type: 'varchar', + default_value: null, + max_length: 100, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'description', + table: 'teams', + data_type: 'text', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'credits', + table: 'teams', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'created_at', + table: 'teams', + data_type: 'datetime', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'activated_at', + table: 'teams', + data_type: 'date', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'id', + table: 'users', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: false, + is_primary_key: true, + has_auto_increment: true, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'team_id', + table: 'users', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: 'id', + foreign_key_table: 'teams', + }, + { + name: 'email', + table: 'users', + data_type: 'varchar', + default_value: null, + max_length: 100, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'password', + table: 'users', + data_type: 'varchar', + default_value: null, + max_length: 60, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'status', + table: 'users', + data_type: 'varchar', + default_value: 'active', + max_length: 60, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + ]); + }); - it('returns information for all columns in specific table', async () => { - expect(await inspector.columnInfo('teams')).to.have.deep.members([ - { - name: 'id', - table: 'teams', - data_type: 'integer', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: false, - is_primary_key: true, - has_auto_increment: true, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'uuid', - table: 'teams', - data_type: 'varchar', - default_value: null, - max_length: 36, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: true, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'name', - table: 'teams', - data_type: 'varchar', - default_value: null, - max_length: 100, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'description', - table: 'teams', - data_type: 'text', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'credits', - table: 'teams', - data_type: 'integer', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'created_at', - table: 'teams', - data_type: 'datetime', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - { - name: 'activated_at', - table: 'teams', - data_type: 'date', - default_value: null, - max_length: null, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: true, - is_unique: false, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, - }, - ]); - }); + it('returns information for all columns in specific table', async () => { + expect(await inspector.columnInfo('teams')).to.have.deep.members([ + { + name: 'id', + table: 'teams', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: false, + is_primary_key: true, + has_auto_increment: true, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'uuid', + table: 'teams', + data_type: 'varchar', + default_value: null, + max_length: 36, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: true, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'name', + table: 'teams', + data_type: 'varchar', + default_value: null, + max_length: 100, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'description', + table: 'teams', + data_type: 'text', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'credits', + table: 'teams', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'created_at', + table: 'teams', + data_type: 'datetime', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + { + name: 'activated_at', + table: 'teams', + data_type: 'date', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }, + ]); + }); - it('returns information for a specific column in a specific table', async () => { - expect(await inspector.columnInfo('teams', 'uuid')).to.deep.equal({ - name: 'uuid', - table: 'teams', - data_type: 'varchar', - default_value: null, - max_length: 36, - numeric_precision: null, - numeric_scale: null, - is_generated: false, - generation_expression: null, - is_nullable: false, - is_unique: true, - is_primary_key: false, - has_auto_increment: false, - foreign_key_column: null, - foreign_key_table: null, + it('returns information for a specific column in a specific table', async () => { + expect(await inspector.columnInfo('teams', 'uuid')).to.deep.equal({ + name: 'uuid', + table: 'teams', + data_type: 'varchar', + default_value: null, + max_length: 36, + numeric_precision: null, + numeric_scale: null, + is_generated: false, + generation_expression: null, + is_nullable: false, + is_unique: true, + is_primary_key: false, + has_auto_increment: false, + foreign_key_column: null, + foreign_key_table: null, + }); + }); }); - }); - }); - describe('.primary', () => { - it('returns primary key for a table', async () => { - expect(await inspector.primary('teams')).to.equal('id'); - expect(await inspector.primary('page_visits')).to.equal(null); - }); - }); + describe('.primary', () => { + it('returns primary key for a table', async () => { + expect(await inspector.primary('teams')).to.equal('id'); + expect(await inspector.primary('page_visits')).to.equal(null); + }); + }); - describe('.foreignKeys', () => { - it('returns foreign keys for all tables', async () => { - expect(await inspector.foreignKeys()).to.deep.equal([ - { - table: 'users', - column: 'team_id', - foreign_key_table: 'teams', - foreign_key_column: 'id', - constraint_name: null, - on_delete: 'CASCADE', - on_update: 'CASCADE', - }, - ]); - }); + describe('.foreignKeys', () => { + it('returns foreign keys for all tables', async () => { + expect(await inspector.foreignKeys()).to.deep.equal([ + { + table: 'users', + column: 'team_id', + foreign_key_table: 'teams', + foreign_key_column: 'id', + constraint_name: null, + on_delete: 'CASCADE', + on_update: 'CASCADE', + }, + ]); + }); - it('filters based on table param', async () => { - expect(await inspector.foreignKeys('teams')).to.deep.equal([]); + it('filters based on table param', async () => { + expect(await inspector.foreignKeys('teams')).to.deep.equal([]); + }); + }); }); }); }); From da1c3f2c872ef3c392dcb47b619887dc0b7ebe61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Adem=20I=C5=9EIKLI?= Date: Sun, 11 Sep 2022 12:37:53 +0300 Subject: [PATCH 5/5] Fixed database file name --- test/sqlite.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sqlite.spec.ts b/test/sqlite.spec.ts index c48b5d9..dc22e4e 100644 --- a/test/sqlite.spec.ts +++ b/test/sqlite.spec.ts @@ -15,7 +15,7 @@ describe('sqlite test suite', function () { database = knex({ client: clientType, connection: { - filename: './test/db/sqlite.db', + filename: `./test/db/${clientType}.db`, }, }); inspector = schemaInspector(database);