pgroll 0.0.2 → 0.0.4
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 +8 -3
- package/dist/cjs/src/cli.js +1 -1
- package/dist/cjs/src/index.d.ts +1 -1
- package/dist/cjs/src/index.js +2 -2
- package/dist/esm/src/cli.js +1 -1
- package/dist/esm/src/index.d.ts +1 -1
- package/dist/esm/src/index.js +2 -2
- package/package.json +11 -8
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
#
|
|
2
|
+
|
|
2
3
|
# pgroll
|
|
3
4
|
|
|
4
5
|
`pgroll` is a lightweight and flexible database migration tool for PostgreSQL
|
|
5
6
|
|
|
6
|
-
PostgreSQL clients currently supporting:
|
|
7
|
+
PostgreSQL clients currently supporting:
|
|
7
8
|
|
|
8
9
|
- [x] PostgresJS
|
|
9
10
|
- [ ] pg
|
|
@@ -27,10 +28,13 @@ npm install pgroll
|
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
## Usage
|
|
31
|
+
|
|
30
32
|
### Command Line Interface (CLI)
|
|
33
|
+
|
|
31
34
|
`pgroll` provides a CLI to manage your database migrations. Below are the available commands:
|
|
32
35
|
|
|
33
36
|
#### Running the CLI
|
|
37
|
+
|
|
34
38
|
1. Run Migrations Up:
|
|
35
39
|
|
|
36
40
|
```bash
|
|
@@ -48,8 +52,9 @@ npx pgroll down
|
|
|
48
52
|
```bash
|
|
49
53
|
npx pgroll go <version>
|
|
50
54
|
```
|
|
55
|
+
|
|
51
56
|
4. Create New Migration Files:
|
|
52
57
|
|
|
53
58
|
```bash
|
|
54
59
|
npx roll create <migration-name>
|
|
55
|
-
```
|
|
60
|
+
```
|
package/dist/cjs/src/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ program
|
|
|
14
14
|
.option('-d, --migrationDir <filepath>', 'Specify migration directory(Default: ./migration)')
|
|
15
15
|
.hook('preAction', cmd => {
|
|
16
16
|
const opts = cmd.opts();
|
|
17
|
-
migrator = new index_1.Migrator((0, postgres_1.default)(), opts.migrationDir
|
|
17
|
+
migrator = new index_1.Migrator((0, postgres_1.default)(), opts.migrationDir);
|
|
18
18
|
});
|
|
19
19
|
program
|
|
20
20
|
.command('up')
|
package/dist/cjs/src/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface IMigrator {
|
|
|
13
13
|
export declare class Migrator implements IMigrator {
|
|
14
14
|
private readonly dbClient;
|
|
15
15
|
readonly migrationsDir: string;
|
|
16
|
-
constructor(dbClient: Sql, migrationsDir
|
|
16
|
+
constructor(dbClient: Sql, migrationsDir?: string);
|
|
17
17
|
ensureMigrationTable(tx: ReservedSql): Promise<void>;
|
|
18
18
|
up(): Promise<void>;
|
|
19
19
|
down(): Promise<void>;
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
6
|
const utils_1 = require("@/utils");
|
|
7
7
|
class Migrator {
|
|
8
|
-
constructor(dbClient, migrationsDir) {
|
|
8
|
+
constructor(dbClient, migrationsDir = '') {
|
|
9
9
|
Object.defineProperty(this, "dbClient", {
|
|
10
10
|
enumerable: true,
|
|
11
11
|
configurable: true,
|
|
@@ -19,7 +19,7 @@ class Migrator {
|
|
|
19
19
|
value: void 0
|
|
20
20
|
});
|
|
21
21
|
this.dbClient = dbClient;
|
|
22
|
-
this.migrationsDir = migrationsDir
|
|
22
|
+
this.migrationsDir = migrationsDir || `${process.cwd()}/migrations`;
|
|
23
23
|
}
|
|
24
24
|
ensureMigrationTable(tx) {
|
|
25
25
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
package/dist/esm/src/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ program
|
|
|
12
12
|
.option('-d, --migrationDir <filepath>', 'Specify migration directory(Default: ./migration)')
|
|
13
13
|
.hook('preAction', cmd => {
|
|
14
14
|
const opts = cmd.opts();
|
|
15
|
-
migrator = new Migrator(postgres(), opts.migrationDir
|
|
15
|
+
migrator = new Migrator(postgres(), opts.migrationDir);
|
|
16
16
|
});
|
|
17
17
|
program
|
|
18
18
|
.command('up')
|
package/dist/esm/src/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface IMigrator {
|
|
|
13
13
|
export declare class Migrator implements IMigrator {
|
|
14
14
|
private readonly dbClient;
|
|
15
15
|
readonly migrationsDir: string;
|
|
16
|
-
constructor(dbClient: Sql, migrationsDir
|
|
16
|
+
constructor(dbClient: Sql, migrationsDir?: string);
|
|
17
17
|
ensureMigrationTable(tx: ReservedSql): Promise<void>;
|
|
18
18
|
up(): Promise<void>;
|
|
19
19
|
down(): Promise<void>;
|
package/dist/esm/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { getMigrationFiles } from '@/utils';
|
|
4
4
|
export class Migrator {
|
|
5
|
-
constructor(dbClient, migrationsDir) {
|
|
5
|
+
constructor(dbClient, migrationsDir = '') {
|
|
6
6
|
Object.defineProperty(this, "dbClient", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
configurable: true,
|
|
@@ -16,7 +16,7 @@ export class Migrator {
|
|
|
16
16
|
value: void 0
|
|
17
17
|
});
|
|
18
18
|
this.dbClient = dbClient;
|
|
19
|
-
this.migrationsDir = migrationsDir
|
|
19
|
+
this.migrationsDir = migrationsDir || `${process.cwd()}/migrations`;
|
|
20
20
|
}
|
|
21
21
|
ensureMigrationTable(tx) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgroll",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Postgres migration tool",
|
|
5
5
|
"main": "dist/cjs/src/index.js",
|
|
6
6
|
"module": "dist/esm/src/index.js",
|
|
7
7
|
"types": "dist/cjs/src/index.d.ts",
|
|
@@ -45,10 +45,13 @@
|
|
|
45
45
|
},
|
|
46
46
|
"license": "ISC",
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"@eslint/compat": "^1.1.0",
|
|
49
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
50
|
+
"@eslint/js": "^9.5.0",
|
|
48
51
|
"@types/jest": "^29.5.12",
|
|
49
|
-
"@types/node": "^20.14.
|
|
52
|
+
"@types/node": "^20.14.8",
|
|
50
53
|
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
51
|
-
"eslint": "^
|
|
54
|
+
"eslint": "^9.5.0",
|
|
52
55
|
"eslint-config-prettier": "^9.1.0",
|
|
53
56
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
54
57
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -59,12 +62,12 @@
|
|
|
59
62
|
"jest": "^29.7.0",
|
|
60
63
|
"prettier": "^3.3.2",
|
|
61
64
|
"ts-jest": "^29.1.5",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"typescript": "^5.4.5"
|
|
65
|
+
"tsx": "^4.15.7",
|
|
66
|
+
"typescript": "=5.4.5"
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|
|
67
69
|
"commander": "^12.1.0",
|
|
68
|
-
"postgres": "^3.4.4"
|
|
70
|
+
"postgres": "^3.4.4",
|
|
71
|
+
"tslib": "^2.6.3"
|
|
69
72
|
}
|
|
70
73
|
}
|