nest-knexjs 0.0.29 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +44 -62
- package/package.json +16 -23
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,71 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
|
6
|
-
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
7
|
-
|
|
8
|
-
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
|
-
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
|
-
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
|
15
|
-
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
16
|
-
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
17
|
-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
18
|
-
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
|
19
|
-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
20
|
-
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
|
21
|
-
</p>
|
|
22
|
-
<!--[](https://opencollective.com/nest#backer)
|
|
23
|
-
[](https://opencollective.com/nest#sponsor)-->
|
|
1
|
+
# nest-knexjs
|
|
2
|
+
|
|
3
|
+
> Warning - This package will no longer be supported in the future
|
|
24
4
|
|
|
25
5
|
## Description
|
|
26
6
|
|
|
27
|
-
Knexjs module for Nest framework (node.js)
|
|
7
|
+
Knexjs module for Nest framework (node.js)
|
|
28
8
|
|
|
29
9
|
## Installation
|
|
30
10
|
|
|
31
11
|
First install the module via `yarn` or `npm` or `pnpm` and do not forget to install the driver package as well:
|
|
32
12
|
|
|
33
|
-
|
|
34
13
|
```bash
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
npm i --save nest-knexjs knex mysql # for mysql/mariadb
|
|
15
|
+
npm i --save nest-knexjs knex pg # for postgresql
|
|
16
|
+
npm i --save nest-knexjs knex sqlite # for sqlite
|
|
17
|
+
npm i --save nest-knexjs knex oracledb # for oracledb
|
|
39
18
|
```
|
|
19
|
+
|
|
40
20
|
or
|
|
41
21
|
|
|
42
22
|
```bash
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
yarn add nest-knexjs knex mysql # for mysql/mariadb
|
|
24
|
+
yarn add nest-knexjs knex pg # for postgresql
|
|
25
|
+
yarn add nest-knexjs knex sqlite # for sqlite
|
|
26
|
+
yarn add nest-knexjs knex oracledb # for oracledb
|
|
47
27
|
```
|
|
48
|
-
|
|
28
|
+
|
|
29
|
+
or
|
|
49
30
|
|
|
50
31
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
pnpm add nest-knexjs knex mysql # for mysql/mariadb
|
|
33
|
+
pnpm add nest-knexjs knex pg # for postgresql
|
|
34
|
+
pnpm add nest-knexjs knex sqlite # for sqlite
|
|
35
|
+
pnpm add nest-knexjs knex oracledb # for oracledb
|
|
55
36
|
```
|
|
56
37
|
|
|
57
38
|
## Table of Contents
|
|
58
39
|
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
64
|
-
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
40
|
+
- [nest-knexjs](#nest-knexjs)
|
|
41
|
+
- [Description](#description)
|
|
42
|
+
- [Installation](#installation)
|
|
43
|
+
- [Table of Contents](#table-of-contents)
|
|
44
|
+
- [Usage](#usage)
|
|
45
|
+
- [KnexModule](#knexmodule)
|
|
46
|
+
- [Example of use](#example-of-use)
|
|
47
|
+
- [Multi Connections Database](#multi-connections-database)
|
|
48
|
+
- [Create Migrations](#create-migrations)
|
|
49
|
+
- [Run Migrations](#run-migrations)
|
|
50
|
+
- [Create Seeds](#create-seeds)
|
|
51
|
+
- [Run Seeds](#run-seeds)
|
|
52
|
+
- [Contribute](#contribute)
|
|
53
|
+
- [License](#license)
|
|
54
|
+
|
|
69
55
|
## Usage
|
|
70
56
|
|
|
71
57
|
### KnexModule
|
|
@@ -90,6 +76,7 @@ KnexModule is the primary entry point for this package and can be used synchrono
|
|
|
90
76
|
],
|
|
91
77
|
})
|
|
92
78
|
```
|
|
79
|
+
|
|
93
80
|
or asynchronously
|
|
94
81
|
|
|
95
82
|
```typescript
|
|
@@ -270,7 +257,6 @@ export class UsersService {
|
|
|
270
257
|
}
|
|
271
258
|
```
|
|
272
259
|
|
|
273
|
-
|
|
274
260
|
In `knexfile.js` update with your database configuration settings:
|
|
275
261
|
|
|
276
262
|
```javascript
|
|
@@ -313,16 +299,16 @@ module.exports = {
|
|
|
313
299
|
Run Migrations:
|
|
314
300
|
|
|
315
301
|
```bash
|
|
316
|
-
|
|
302
|
+
npx knex migrate:latest --env development
|
|
317
303
|
|
|
318
|
-
|
|
304
|
+
npx knex migrate:latest --env developmentTwo
|
|
319
305
|
```
|
|
320
306
|
|
|
321
307
|
## Create Migrations
|
|
322
308
|
|
|
323
309
|
```bash
|
|
324
|
-
|
|
325
|
-
|
|
310
|
+
npx knex init
|
|
311
|
+
npx knex migrate:make [name_migrations]
|
|
326
312
|
```
|
|
327
313
|
|
|
328
314
|
Example file migrations:
|
|
@@ -365,16 +351,16 @@ module.exports = {
|
|
|
365
351
|
}
|
|
366
352
|
```
|
|
367
353
|
|
|
368
|
-
then we run the following command from the terminal
|
|
354
|
+
then we run the following command from the terminal
|
|
369
355
|
|
|
370
356
|
```bash
|
|
371
|
-
|
|
357
|
+
npx knex migrate:latest
|
|
372
358
|
```
|
|
373
359
|
|
|
374
360
|
## Create Seeds
|
|
375
361
|
|
|
376
362
|
```bash
|
|
377
|
-
|
|
363
|
+
npx knex seed:make [name_seed]
|
|
378
364
|
```
|
|
379
365
|
|
|
380
366
|
Example file seeds
|
|
@@ -396,18 +382,14 @@ exports.seed = function (knex) {
|
|
|
396
382
|
## Run Seeds
|
|
397
383
|
|
|
398
384
|
```
|
|
399
|
-
|
|
385
|
+
npx knex seed:run
|
|
400
386
|
```
|
|
401
387
|
|
|
402
388
|
For more information on `Knex.js` see [here](http://knexjs.org/)
|
|
403
389
|
|
|
404
390
|
## Contribute
|
|
405
|
-
Feel free to help this library, I'm quite busy with also another Nestjs packages, but the community will appreciate the effort of improving this library. Make sure you follow the guidelines
|
|
406
391
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
- Author - [Tony133](https://github.com/Tony133)
|
|
410
|
-
- Framework - [https://nestjs.com](https://nestjs.com/)
|
|
392
|
+
Feel free to help this library, I'm quite busy with also another Nestjs packages, but the community will appreciate the effort of improving this library. Make sure you follow the guidelines
|
|
411
393
|
|
|
412
394
|
## License
|
|
413
395
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nest-knexjs",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Knexjs module for Nest framework (node.js)
|
|
5
|
-
"author": "Tony133",
|
|
3
|
+
"version": "0.0.31",
|
|
4
|
+
"description": "Knexjs module for Nest framework (node.js)",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"scripts": {
|
|
8
7
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
@@ -15,40 +14,38 @@
|
|
|
15
14
|
"test:e2e": "jest --config ./tests/jest-e2e.json --detectOpenHandles --forceExit",
|
|
16
15
|
"test:e2e:dev": "jest --config ./tests/jest-e2e.json --runInBand --watch",
|
|
17
16
|
"prerelease": "npm run build",
|
|
18
|
-
"release": "release-it",
|
|
19
17
|
"prepare": "husky"
|
|
20
18
|
},
|
|
21
19
|
"devDependencies": {
|
|
22
|
-
"@commitlint/cli": "20.2
|
|
23
|
-
"@commitlint/config-angular": "20.2
|
|
20
|
+
"@commitlint/cli": "20.4.2",
|
|
21
|
+
"@commitlint/config-angular": "20.4.2",
|
|
24
22
|
"@eslint/eslintrc": "3.3.3",
|
|
25
|
-
"@eslint/js": "9.39.
|
|
26
|
-
"@nestjs/common": "11.1.
|
|
27
|
-
"@nestjs/core": "11.1.
|
|
28
|
-
"@nestjs/platform-fastify": "11.1.
|
|
29
|
-
"@nestjs/testing": "11.1.
|
|
23
|
+
"@eslint/js": "9.39.3",
|
|
24
|
+
"@nestjs/common": "11.1.14",
|
|
25
|
+
"@nestjs/core": "11.1.14",
|
|
26
|
+
"@nestjs/platform-fastify": "11.1.14",
|
|
27
|
+
"@nestjs/testing": "11.1.14",
|
|
30
28
|
"@types/jest": "30.0.0",
|
|
31
|
-
"@types/node": "24.10.
|
|
29
|
+
"@types/node": "24.10.13",
|
|
32
30
|
"@types/supertest": "6.0.3",
|
|
33
|
-
"eslint": "9.39.
|
|
31
|
+
"eslint": "9.39.3",
|
|
34
32
|
"eslint-config-prettier": "10.1.8",
|
|
35
33
|
"eslint-plugin-import": "2.32.0",
|
|
36
|
-
"eslint-plugin-prettier": "5.5.
|
|
37
|
-
"globals": "
|
|
34
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
35
|
+
"globals": "17.3.0",
|
|
38
36
|
"husky": "9.1.7",
|
|
39
37
|
"jest": "30.2.0",
|
|
40
38
|
"knex": "3.1.0",
|
|
41
39
|
"mysql": "2.18.1",
|
|
42
|
-
"prettier": "3.
|
|
40
|
+
"prettier": "3.8.1",
|
|
43
41
|
"reflect-metadata": "0.2.2",
|
|
44
|
-
"release-it": "19.1.0",
|
|
45
42
|
"rxjs": "7.8.2",
|
|
46
|
-
"supertest": "7.
|
|
43
|
+
"supertest": "7.2.2",
|
|
47
44
|
"ts-jest": "29.4.6",
|
|
48
45
|
"ts-node": "10.9.2",
|
|
49
46
|
"tsconfig-paths": "4.2.0",
|
|
50
47
|
"typescript": "5.9.3",
|
|
51
|
-
"typescript-eslint": "8.
|
|
48
|
+
"typescript-eslint": "8.56.0"
|
|
52
49
|
},
|
|
53
50
|
"peerDependencies": {
|
|
54
51
|
"@nestjs/common": "^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
@@ -59,9 +56,5 @@
|
|
|
59
56
|
},
|
|
60
57
|
"lint-staged": {
|
|
61
58
|
"**/*.{ts,json}": []
|
|
62
|
-
},
|
|
63
|
-
"repository": {
|
|
64
|
-
"type": "git",
|
|
65
|
-
"url": "https://github.com/tony133/nestjs-knexjs"
|
|
66
59
|
}
|
|
67
60
|
}
|