nest-knexjs 0.0.30 → 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/README.md +43 -41
- package/package.json +9 -14
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# nest-knexjs
|
|
2
|
+
|
|
3
|
+
> Warning - This package will no longer be supported in the future
|
|
4
4
|
|
|
5
5
|
## Description
|
|
6
6
|
|
|
@@ -10,42 +10,48 @@ Knexjs module for Nest framework (node.js)
|
|
|
10
10
|
|
|
11
11
|
First install the module via `yarn` or `npm` or `pnpm` and do not forget to install the driver package as well:
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
```bash
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
19
18
|
```
|
|
19
|
+
|
|
20
20
|
or
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
27
27
|
```
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
or
|
|
29
30
|
|
|
30
31
|
```bash
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
## Table of Contents
|
|
38
39
|
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
- [
|
|
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
|
+
|
|
49
55
|
## Usage
|
|
50
56
|
|
|
51
57
|
### KnexModule
|
|
@@ -70,6 +76,7 @@ KnexModule is the primary entry point for this package and can be used synchrono
|
|
|
70
76
|
],
|
|
71
77
|
})
|
|
72
78
|
```
|
|
79
|
+
|
|
73
80
|
or asynchronously
|
|
74
81
|
|
|
75
82
|
```typescript
|
|
@@ -250,7 +257,6 @@ export class UsersService {
|
|
|
250
257
|
}
|
|
251
258
|
```
|
|
252
259
|
|
|
253
|
-
|
|
254
260
|
In `knexfile.js` update with your database configuration settings:
|
|
255
261
|
|
|
256
262
|
```javascript
|
|
@@ -293,16 +299,16 @@ module.exports = {
|
|
|
293
299
|
Run Migrations:
|
|
294
300
|
|
|
295
301
|
```bash
|
|
296
|
-
|
|
302
|
+
npx knex migrate:latest --env development
|
|
297
303
|
|
|
298
|
-
|
|
304
|
+
npx knex migrate:latest --env developmentTwo
|
|
299
305
|
```
|
|
300
306
|
|
|
301
307
|
## Create Migrations
|
|
302
308
|
|
|
303
309
|
```bash
|
|
304
|
-
|
|
305
|
-
|
|
310
|
+
npx knex init
|
|
311
|
+
npx knex migrate:make [name_migrations]
|
|
306
312
|
```
|
|
307
313
|
|
|
308
314
|
Example file migrations:
|
|
@@ -345,16 +351,16 @@ module.exports = {
|
|
|
345
351
|
}
|
|
346
352
|
```
|
|
347
353
|
|
|
348
|
-
then we run the following command from the terminal
|
|
354
|
+
then we run the following command from the terminal
|
|
349
355
|
|
|
350
356
|
```bash
|
|
351
|
-
|
|
357
|
+
npx knex migrate:latest
|
|
352
358
|
```
|
|
353
359
|
|
|
354
360
|
## Create Seeds
|
|
355
361
|
|
|
356
362
|
```bash
|
|
357
|
-
|
|
363
|
+
npx knex seed:make [name_seed]
|
|
358
364
|
```
|
|
359
365
|
|
|
360
366
|
Example file seeds
|
|
@@ -376,18 +382,14 @@ exports.seed = function (knex) {
|
|
|
376
382
|
## Run Seeds
|
|
377
383
|
|
|
378
384
|
```
|
|
379
|
-
|
|
385
|
+
npx knex seed:run
|
|
380
386
|
```
|
|
381
387
|
|
|
382
388
|
For more information on `Knex.js` see [here](http://knexjs.org/)
|
|
383
389
|
|
|
384
390
|
## Contribute
|
|
385
|
-
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
|
|
386
391
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
- Author - [Tony133](https://github.com/Tony133)
|
|
390
|
-
- 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
|
|
391
393
|
|
|
392
394
|
## License
|
|
393
395
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nest-knexjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "Knexjs module for Nest framework (node.js)",
|
|
5
|
-
"author": "Tony133",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"scripts": {
|
|
8
7
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
@@ -18,18 +17,18 @@
|
|
|
18
17
|
"prepare": "husky"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
|
-
"@commitlint/cli": "20.4.
|
|
22
|
-
"@commitlint/config-angular": "20.4.
|
|
20
|
+
"@commitlint/cli": "20.4.2",
|
|
21
|
+
"@commitlint/config-angular": "20.4.2",
|
|
23
22
|
"@eslint/eslintrc": "3.3.3",
|
|
24
|
-
"@eslint/js": "9.39.
|
|
25
|
-
"@nestjs/common": "11.1.
|
|
26
|
-
"@nestjs/core": "11.1.
|
|
27
|
-
"@nestjs/platform-fastify": "11.1.
|
|
28
|
-
"@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",
|
|
29
28
|
"@types/jest": "30.0.0",
|
|
30
29
|
"@types/node": "24.10.13",
|
|
31
30
|
"@types/supertest": "6.0.3",
|
|
32
|
-
"eslint": "9.39.
|
|
31
|
+
"eslint": "9.39.3",
|
|
33
32
|
"eslint-config-prettier": "10.1.8",
|
|
34
33
|
"eslint-plugin-import": "2.32.0",
|
|
35
34
|
"eslint-plugin-prettier": "5.5.5",
|
|
@@ -57,9 +56,5 @@
|
|
|
57
56
|
},
|
|
58
57
|
"lint-staged": {
|
|
59
58
|
"**/*.{ts,json}": []
|
|
60
|
-
},
|
|
61
|
-
"repository": {
|
|
62
|
-
"type": "git",
|
|
63
|
-
"url": "https://github.com/tony133/nestjs-knexjs"
|
|
64
59
|
}
|
|
65
60
|
}
|