db-evo 1.0.9 → 1.1.1
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 +107 -12
- package/dist/commands.d.ts +6 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +23 -6
- package/dist/commands.js.map +1 -1
- package/dist/core/db-adapter.d.ts +3 -0
- package/dist/core/db-adapter.d.ts.map +1 -1
- package/dist/core/db-adapter.js.map +1 -1
- package/dist/core/db-migration-manager.d.ts +9 -1
- package/dist/core/db-migration-manager.d.ts.map +1 -1
- package/dist/core/db-migration-manager.js +25 -4
- package/dist/core/db-migration-manager.js.map +1 -1
- package/dist/core/migration-resolver.d.ts +2 -2
- package/dist/core/migration-resolver.d.ts.map +1 -1
- package/dist/core/migration-resolver.js +7 -4
- package/dist/core/migration-resolver.js.map +1 -1
- package/dist/core/migration.d.ts +13 -4
- package/dist/core/migration.d.ts.map +1 -1
- package/dist/core/migration.js +81 -38
- package/dist/core/migration.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/pg/pg-db-adapter.d.ts +6 -0
- package/dist/pg/pg-db-adapter.d.ts.map +1 -1
- package/dist/pg/pg-db-adapter.js +30 -13
- package/dist/pg/pg-db-adapter.js.map +1 -1
- package/package.json +61 -56
package/README.md
CHANGED
|
@@ -1,22 +1,117 @@
|
|
|
1
1
|
# db-evo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
PostgreSQL database migration tool with dependency resolution and versioned schema management.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
- **Versioned Migrations**: Organize database changes in numbered patches
|
|
8
|
+
- **Dependency Resolution**: Define and resolve migration dependencies
|
|
9
|
+
- **Operation Types**: Support for deploy, revert, and verify operations
|
|
10
|
+
- **PostgreSQL Support**: Native PostgreSQL integration with connection pooling
|
|
11
|
+
- **Dry Run Mode**: Preview changes before applying them
|
|
12
|
+
- **Migration Tracking**: Automatic tracking of applied migrations
|
|
10
13
|
|
|
11
|
-
##
|
|
12
|
-
* Node.js
|
|
13
|
-
* [psql](https://postgrespro.com/docs/postgrespro/13/app-psql)
|
|
14
|
-
* [createdb](https://postgrespro.com/docs/postgrespro/13/app-createdb)
|
|
14
|
+
## Requirements
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
- **psql**: PostgreSQL command-line client must be installed
|
|
17
|
+
- **Platform**: Currently supports Linux only (other platforms coming soon)
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
## Installation
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g db-evo
|
|
23
|
+
```
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
1. Create a migration directory structure:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
migrations/
|
|
31
|
+
├── 00/
|
|
32
|
+
│ ├── db-evo.yaml
|
|
33
|
+
│ └── deploy/
|
|
34
|
+
│ └── 01-create-users.sql
|
|
35
|
+
├── 01/
|
|
36
|
+
│ ├── db-evo.yaml
|
|
37
|
+
│ └── deploy/
|
|
38
|
+
│ └── 01-create-posts.sql
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Configure database connection in `db-evo.yaml`:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
pg:
|
|
45
|
+
default:
|
|
46
|
+
dbname: myapp
|
|
47
|
+
host: localhost
|
|
48
|
+
port: 5432
|
|
49
|
+
username: postgres
|
|
50
|
+
password: secret
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
3. Deploy migrations:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
db-evo deploy
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Commands
|
|
60
|
+
|
|
61
|
+
- `db-evo deploy` - Apply pending migrations
|
|
62
|
+
- `db-evo revert` - Rollback the latest migration
|
|
63
|
+
- `db-evo verify` - Validate applied migrations
|
|
64
|
+
- `db-evo status` - Show current migration state
|
|
65
|
+
- `db-evo list` - List all applied patches
|
|
66
|
+
- `db-evo info` - Display configuration details
|
|
67
|
+
- `db-evo tree` - Show migration dependency tree
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
Create `db-evo.yaml` files to configure migrations:
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
# Root configuration
|
|
75
|
+
pg:
|
|
76
|
+
default:
|
|
77
|
+
dbname: myapp
|
|
78
|
+
host: localhost
|
|
79
|
+
port: 5432
|
|
80
|
+
username: postgres
|
|
81
|
+
password: secret
|
|
82
|
+
production:
|
|
83
|
+
dbname: myapp_prod
|
|
84
|
+
host: prod.example.com
|
|
85
|
+
|
|
86
|
+
# Per-migration configuration
|
|
87
|
+
depends: ["00"] # Require patch 00 before applying
|
|
88
|
+
includes: ["shared"] # Include shared migrations
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Migration Structure
|
|
92
|
+
|
|
93
|
+
Each migration patch follows this structure:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
patch-name/
|
|
97
|
+
├── db-evo.yaml # Configuration (optional)
|
|
98
|
+
├── vars.yaml # Variables for templates (optional)
|
|
99
|
+
├── deploy/ # Forward migration scripts
|
|
100
|
+
│ ├── 01.sql
|
|
101
|
+
│ └── 02.sql
|
|
102
|
+
├── revert/ # Rollback scripts (optional)
|
|
103
|
+
│ └── 01.sql
|
|
104
|
+
└── verify/ # Verification scripts (optional)
|
|
105
|
+
└── 01.sql
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Options
|
|
109
|
+
|
|
110
|
+
- `--env <env>` - Target environment (default: "default")
|
|
111
|
+
- `--patch <name>` - Specific patch to operate on
|
|
112
|
+
- `--dry-run` - Preview changes without applying
|
|
113
|
+
- `--engine <type>` - Database engine (currently only "pg")
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT
|
package/dist/commands.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface Argv extends PgDbConnection {
|
|
|
6
6
|
engine: string;
|
|
7
7
|
p: string;
|
|
8
8
|
patch: string;
|
|
9
|
+
dryRun: boolean;
|
|
10
|
+
noInstall: boolean;
|
|
9
11
|
}
|
|
10
12
|
export interface Config {
|
|
11
13
|
pg: {
|
|
@@ -14,6 +16,7 @@ export interface Config {
|
|
|
14
16
|
patch: string;
|
|
15
17
|
env: string;
|
|
16
18
|
engine: EngineType;
|
|
19
|
+
roots: string[];
|
|
17
20
|
}
|
|
18
21
|
export declare type CommandHandler<O> = (o?: O) => Promise<any>;
|
|
19
22
|
export interface CommandsController {
|
|
@@ -22,6 +25,9 @@ export interface CommandsController {
|
|
|
22
25
|
verify: CommandHandler<unknown>;
|
|
23
26
|
status: CommandHandler<unknown>;
|
|
24
27
|
list: CommandHandler<unknown>;
|
|
28
|
+
info: CommandHandler<unknown>;
|
|
29
|
+
tree: CommandHandler<unknown>;
|
|
30
|
+
template: CommandHandler<unknown>;
|
|
25
31
|
}
|
|
26
32
|
declare type CommandName = keyof CommandsController;
|
|
27
33
|
declare type EngineType = "pg";
|
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEhE,MAAM,WAAW,IAAK,SAAQ,cAAc;IAC1C,CAAC,EAAE,WAAW,EAAE,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"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WAAW,EAChB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,cAAc,CAAC,OAAO,CAAC,CAsCzB"}
|
package/dist/commands.js
CHANGED
|
@@ -6,7 +6,10 @@ const pg_db_adapter_1 = require("./pg/pg-db-adapter");
|
|
|
6
6
|
function getDbAdapter(argv, cfg) {
|
|
7
7
|
const engine = (argv.engine ?? cfg.engine ?? "pg");
|
|
8
8
|
const env = argv.env ?? cfg.env ?? "default";
|
|
9
|
-
const connection =
|
|
9
|
+
const connection = {
|
|
10
|
+
...(cfg[engine]["default"] ?? {}),
|
|
11
|
+
...(cfg[engine][env] ?? {}),
|
|
12
|
+
};
|
|
10
13
|
const props = [
|
|
11
14
|
"dbname",
|
|
12
15
|
"host",
|
|
@@ -15,19 +18,24 @@ function getDbAdapter(argv, cfg) {
|
|
|
15
18
|
"username",
|
|
16
19
|
];
|
|
17
20
|
props.forEach((prop) => {
|
|
18
|
-
connection[prop] = (argv[prop] ?? connection[prop]);
|
|
21
|
+
connection[prop] = (argv[prop] ?? connection[prop] ?? null);
|
|
19
22
|
});
|
|
20
|
-
const dbAdapter = new pg_db_adapter_1.PgDbAdapter({ connection });
|
|
23
|
+
const dbAdapter = new pg_db_adapter_1.PgDbAdapter({ connection, env });
|
|
21
24
|
return dbAdapter;
|
|
22
25
|
}
|
|
23
26
|
function getCommandHandler(cmd, argv, config) {
|
|
24
27
|
const dbAdapter = getDbAdapter(argv, config);
|
|
25
28
|
const cwd = argv.cwd ?? process.cwd();
|
|
26
|
-
const patch = argv.p
|
|
27
|
-
const mm = new db_migration_manager_1.DbMigrationManager({
|
|
29
|
+
const patch = argv.p || argv.patch || config.patch || "";
|
|
30
|
+
const mm = new db_migration_manager_1.DbMigrationManager({
|
|
31
|
+
dbAdapter,
|
|
32
|
+
cwd,
|
|
33
|
+
roots: config.roots,
|
|
34
|
+
patch,
|
|
35
|
+
});
|
|
28
36
|
const commands = {
|
|
29
37
|
deploy: async () => {
|
|
30
|
-
await mm.deploy();
|
|
38
|
+
await mm.deploy(argv);
|
|
31
39
|
},
|
|
32
40
|
verify: async () => {
|
|
33
41
|
await mm.verify();
|
|
@@ -41,6 +49,15 @@ function getCommandHandler(cmd, argv, config) {
|
|
|
41
49
|
list: async () => {
|
|
42
50
|
await mm.list();
|
|
43
51
|
},
|
|
52
|
+
info: async () => {
|
|
53
|
+
await mm.info();
|
|
54
|
+
},
|
|
55
|
+
tree: async () => {
|
|
56
|
+
await mm.tree();
|
|
57
|
+
},
|
|
58
|
+
template: async () => {
|
|
59
|
+
await mm.template();
|
|
60
|
+
},
|
|
44
61
|
};
|
|
45
62
|
return commands[cmd];
|
|
46
63
|
}
|
package/dist/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;;AACA,sEAAgE;AAChE,sDAAgE;
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;;AACA,sEAAgE;AAChE,sDAAgE;AAuChE,SAAS,YAAY,CAAC,IAAU,EAAE,GAAW;IAC3C,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,CAAe,CAAA;IAChE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,SAAS,CAAA;IAC5C,MAAM,UAAU,GAAG;QACjB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACjC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;KACV,CAAA;IAEnB,MAAM,KAAK,GAA6B;QACtC,QAAQ;QACR,MAAM;QACN,UAAU;QACV,MAAM;QACN,UAAU;KACX,CAAA;IAED,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB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EAAE,CAAC,IAAI,EAAE,CAAA;QACjB,CAAC;QACD,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,EAAE,CAAC,IAAI,EAAE,CAAA;QACjB,CAAC;QACD,QAAQ,EAAE,KAAK,IAAI,EAAE;YACnB,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAA;QACrB,CAAC;KACF,CAAA;IAED,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;AACtB,CAAC;AA1CD,8CA0CC"}
|
|
@@ -7,6 +7,8 @@ export interface IDbPatchEntry {
|
|
|
7
7
|
}
|
|
8
8
|
export declare abstract class DbAdapter {
|
|
9
9
|
abstract initialize(): Promise<void>;
|
|
10
|
+
abstract getEnvName(): string;
|
|
11
|
+
abstract getConfig<T>(): T;
|
|
10
12
|
abstract hasPatch(ver: string): Promise<boolean>;
|
|
11
13
|
abstract registerPatch({ ver, note, checksum }: {
|
|
12
14
|
ver: any;
|
|
@@ -20,6 +22,7 @@ export declare abstract class DbAdapter {
|
|
|
20
22
|
unregister?: boolean;
|
|
21
23
|
note?: string;
|
|
22
24
|
files: string[];
|
|
25
|
+
dryRun?: boolean;
|
|
23
26
|
}): Promise<void>;
|
|
24
27
|
abstract list(): Promise<IDbPatchEntry[]>;
|
|
25
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-adapter.d.ts","sourceRoot":"","sources":["../../src/core/db-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AACD,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"db-adapter.d.ts","sourceRoot":"","sources":["../../src/core/db-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AACD,8BAAsB,SAAS;IAC7B,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IACpC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAC7B,QAAQ,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAChD,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;;;;KAAA,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9D,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACpD,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE;QACvB,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,CAAC,EAAE,OAAO,CAAA;KACjB,GAAG,OAAO,CAAC,IAAI,CAAC;IACjB,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-adapter.js","sourceRoot":"","sources":["../../src/core/db-adapter.ts"],"names":[],"mappings":";;;AAOA,MAAsB,SAAS;
|
|
1
|
+
{"version":3,"file":"db-adapter.js","sourceRoot":"","sources":["../../src/core/db-adapter.ts"],"names":[],"mappings":";;;AAOA,MAAsB,SAAS;CAgB9B;AAhBD,8BAgBC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DbAdapter } from "./db-adapter";
|
|
2
2
|
export interface DbMigrationManagerArgs {
|
|
3
3
|
cwd: string;
|
|
4
|
+
roots: string[];
|
|
4
5
|
patch: string;
|
|
5
6
|
dbAdapter: DbAdapter;
|
|
6
7
|
}
|
|
@@ -8,14 +9,21 @@ export declare class DbMigrationManager {
|
|
|
8
9
|
private args;
|
|
9
10
|
constructor(args: DbMigrationManagerArgs);
|
|
10
11
|
get cwd(): string;
|
|
12
|
+
get roots(): string[];
|
|
11
13
|
get dbAdapter(): DbAdapter;
|
|
12
14
|
resolvePatchName(): Promise<string>;
|
|
13
15
|
getPatchName(): Promise<string>;
|
|
14
|
-
deploy(
|
|
16
|
+
deploy(args: {
|
|
17
|
+
dryRun: boolean;
|
|
18
|
+
noInstall?: boolean;
|
|
19
|
+
}): Promise<void>;
|
|
15
20
|
verify(): Promise<void>;
|
|
16
21
|
revert(): Promise<void>;
|
|
17
22
|
private doOperation;
|
|
18
23
|
status(): Promise<void>;
|
|
19
24
|
list(): Promise<void>;
|
|
25
|
+
info(): Promise<void>;
|
|
26
|
+
tree(): Promise<void>;
|
|
27
|
+
template(): Promise<void>;
|
|
20
28
|
}
|
|
21
29
|
//# sourceMappingURL=db-migration-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-migration-manager.d.ts","sourceRoot":"","sources":["../../src/core/db-migration-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db-migration-manager.d.ts","sourceRoot":"","sources":["../../src/core/db-migration-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,qBAAa,kBAAkB;IACjB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,sBAAsB;IAEhD,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,KAAK,IAAI,MAAM,EAAE,CAEpB;IAED,IAAI,SAAS,IAAI,SAAS,CAEzB;IAEK,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAMnC,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAI/B,MAAM,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAIf,WAAW;IAgBnB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAChC"}
|
|
@@ -13,6 +13,9 @@ class DbMigrationManager {
|
|
|
13
13
|
get cwd() {
|
|
14
14
|
return this.args.cwd;
|
|
15
15
|
}
|
|
16
|
+
get roots() {
|
|
17
|
+
return [this.cwd, ...(this.args.roots ?? [])].filter(Boolean);
|
|
18
|
+
}
|
|
16
19
|
get dbAdapter() {
|
|
17
20
|
return this.args.dbAdapter;
|
|
18
21
|
}
|
|
@@ -24,8 +27,8 @@ class DbMigrationManager {
|
|
|
24
27
|
async getPatchName() {
|
|
25
28
|
return this.args.patch || (await this.resolvePatchName());
|
|
26
29
|
}
|
|
27
|
-
async deploy() {
|
|
28
|
-
await this.doOperation((x) => x.deploy());
|
|
30
|
+
async deploy(args) {
|
|
31
|
+
await this.doOperation((x) => x.deploy(args));
|
|
29
32
|
}
|
|
30
33
|
async verify() {
|
|
31
34
|
await this.doOperation((x) => x.verify());
|
|
@@ -37,7 +40,7 @@ class DbMigrationManager {
|
|
|
37
40
|
console.log(chalk_1.default.grey(`Initialize...`));
|
|
38
41
|
await this.dbAdapter.initialize();
|
|
39
42
|
const migrationResolver = new migration_resolver_1.MigrationResolver({
|
|
40
|
-
|
|
43
|
+
roots: this.roots,
|
|
41
44
|
dbAdapter: this.dbAdapter,
|
|
42
45
|
});
|
|
43
46
|
const patch = await this.getPatchName();
|
|
@@ -51,7 +54,7 @@ class DbMigrationManager {
|
|
|
51
54
|
const ls = await this.dbAdapter.list();
|
|
52
55
|
const last = ls[ls.length - 1];
|
|
53
56
|
if (last) {
|
|
54
|
-
console.log(chalk_1.default.yellow(`Last patch '${last.ver}' ${last.note ? `(${last.note})` : ""}installed at ${last.tm}`));
|
|
57
|
+
console.log(chalk_1.default.yellow(`Last patch '${last.ver}' ${last.note ? `(${last.note})` : ""} installed at ${last.tm?.toISOString() || "<unknown>"}`));
|
|
55
58
|
}
|
|
56
59
|
console.log(chalk_1.default.yellow(`Expected patch is '${patch}'`), last?.ver === patch
|
|
57
60
|
? chalk_1.default.green(`- DEPLOYED`)
|
|
@@ -61,6 +64,24 @@ class DbMigrationManager {
|
|
|
61
64
|
const ls = await this.dbAdapter.list();
|
|
62
65
|
console.log(ls);
|
|
63
66
|
}
|
|
67
|
+
async info() {
|
|
68
|
+
const patch = await this.getPatchName();
|
|
69
|
+
const cfg = this.dbAdapter.getConfig();
|
|
70
|
+
const print = (a, b) => `${chalk_1.default.white(a)} : ${chalk_1.default.yellow(b)}`;
|
|
71
|
+
console.log(`
|
|
72
|
+
${print("Working dir", this.cwd)}
|
|
73
|
+
${print("Env", this.dbAdapter.getEnvName())}
|
|
74
|
+
${print("Patch", patch)}
|
|
75
|
+
${print("DB", cfg.database)}
|
|
76
|
+
${print("Host", cfg.host)}
|
|
77
|
+
${print("Port", cfg.port + "")}
|
|
78
|
+
${print("User", cfg.user)}
|
|
79
|
+
`);
|
|
80
|
+
}
|
|
81
|
+
async tree() {
|
|
82
|
+
await this.doOperation((x) => x.tree());
|
|
83
|
+
}
|
|
84
|
+
async template() { }
|
|
64
85
|
}
|
|
65
86
|
exports.DbMigrationManager = DbMigrationManager;
|
|
66
87
|
//# sourceMappingURL=db-migration-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-migration-manager.js","sourceRoot":"","sources":["../../src/core/db-migration-manager.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,0DAAyB;
|
|
1
|
+
{"version":3,"file":"db-migration-manager.js","sourceRoot":"","sources":["../../src/core/db-migration-manager.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,0DAAyB;AAGzB,yCAA2C;AAE3C,6DAAwD;AASxD,MAAa,kBAAkB;IAC7B,YAAoB,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;IAAG,CAAC;IAEpD,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;IACtB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC/D,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,GAAG,yBAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACrC,IAAI,CAAC,IAAI,EAAE,CAAA;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,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AAG,CAAC;EAC9B,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;EACzC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;EACrB,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC;EACzB,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;EACvB,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;EAC5B,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;CACxB,CAAC,CAAA;IACA,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,QAAQ,KAAmB,CAAC;CACnC;AArGD,gDAqGC"}
|
|
@@ -2,12 +2,12 @@ import { Migration } from "./migration";
|
|
|
2
2
|
import { DbAdapter } from "./db-adapter";
|
|
3
3
|
export declare class MigrationResolver {
|
|
4
4
|
args: {
|
|
5
|
-
|
|
5
|
+
roots: string[];
|
|
6
6
|
dbAdapter: DbAdapter;
|
|
7
7
|
};
|
|
8
8
|
private cache;
|
|
9
9
|
constructor(args: {
|
|
10
|
-
|
|
10
|
+
roots: string[];
|
|
11
11
|
dbAdapter: DbAdapter;
|
|
12
12
|
});
|
|
13
13
|
private doResolve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-resolver.d.ts","sourceRoot":"","sources":["../../src/core/migration-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,qBAAa,iBAAiB;IAGT,IAAI,EAAE;QAAE,
|
|
1
|
+
{"version":3,"file":"migration-resolver.d.ts","sourceRoot":"","sources":["../../src/core/migration-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,qBAAa,iBAAiB;IAGT,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE;IAFlE,OAAO,CAAC,KAAK,CAA+B;gBAEzB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE;IAElE,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;CAQjC"}
|
|
@@ -11,11 +11,14 @@ class MigrationResolver {
|
|
|
11
11
|
this.cache = new Map();
|
|
12
12
|
}
|
|
13
13
|
doResolve(name) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const dir = this.args.roots
|
|
15
|
+
.map((s) => path_1.default.join(s, name))
|
|
16
|
+
.find((s) => fs_utils_1.isDirExists(s));
|
|
17
|
+
if (!dir)
|
|
18
|
+
throw new Error(`Dir '${name}' not exists`);
|
|
17
19
|
return new migration_1.Migration({
|
|
18
|
-
cwd,
|
|
20
|
+
cwd: dir,
|
|
21
|
+
name,
|
|
19
22
|
resolver: this,
|
|
20
23
|
dbAdapter: this.args.dbAdapter,
|
|
21
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-resolver.js","sourceRoot":"","sources":["../../src/core/migration-resolver.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,wDAAuB;AACvB,yCAAwC;AAGxC,MAAa,iBAAiB;IAG5B,YAAmB,
|
|
1
|
+
{"version":3,"file":"migration-resolver.js","sourceRoot":"","sources":["../../src/core/migration-resolver.ts"],"names":[],"mappings":";;;;AAAA,2CAAuC;AACvC,wDAAuB;AACvB,yCAAwC;AAGxC,MAAa,iBAAiB;IAG5B,YAAmB,IAA+C;QAA/C,SAAI,GAAJ,IAAI,CAA2C;QAF1D,UAAK,GAAG,IAAI,GAAG,EAAqB,CAAA;IAEyB,CAAC;IAE9D,SAAS,CAAC,IAAY;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;aACxB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aAC9B,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAW,CAAC,CAAC,CAAC,CAAC,CAAA;QAE9B,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,cAAc,CAAC,CAAA;QACrD,OAAO,IAAI,qBAAS,CAAC;YACnB,GAAG,EAAE,GAAG;YACR,IAAI;YACJ,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS;SAC/B,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,CAAC,EAAE;YACN,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YACxB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;SACxB;QACD,OAAO,CAAC,CAAA;IACV,CAAC;CACF;AA3BD,8CA2BC"}
|
package/dist/core/migration.d.ts
CHANGED
|
@@ -5,10 +5,12 @@ export interface IMigrationResolver {
|
|
|
5
5
|
export interface MigrationConfig {
|
|
6
6
|
depends: string[];
|
|
7
7
|
requires: string[];
|
|
8
|
+
includes: string[];
|
|
8
9
|
}
|
|
9
10
|
export declare class Migration {
|
|
10
11
|
args: {
|
|
11
12
|
cwd: string;
|
|
13
|
+
name: string;
|
|
12
14
|
resolver: IMigrationResolver;
|
|
13
15
|
dbAdapter: DbAdapter;
|
|
14
16
|
};
|
|
@@ -16,21 +18,28 @@ export declare class Migration {
|
|
|
16
18
|
cfg: MigrationConfig;
|
|
17
19
|
constructor(args: {
|
|
18
20
|
cwd: string;
|
|
21
|
+
name: string;
|
|
19
22
|
resolver: IMigrationResolver;
|
|
20
23
|
dbAdapter: DbAdapter;
|
|
21
24
|
});
|
|
22
25
|
get dbAdapter(): DbAdapter;
|
|
23
26
|
get cwd(): string;
|
|
24
27
|
getConfig(): Promise<MigrationConfig>;
|
|
28
|
+
includes(): Promise<string[]>;
|
|
25
29
|
requires(): Promise<string[]>;
|
|
26
30
|
getParents(): Promise<Migration[]>;
|
|
31
|
+
getIncludes(): Promise<Migration[]>;
|
|
27
32
|
isApplied(): Promise<boolean>;
|
|
28
33
|
getSQLFiles(op: string): Promise<string[]>;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
private handled;
|
|
35
|
+
doOnce<T = void>(fn: () => Promise<T>): Promise<T>;
|
|
36
|
+
deploy(args: {
|
|
37
|
+
dryRun: boolean;
|
|
38
|
+
noInstall?: boolean;
|
|
39
|
+
}): Promise<void>;
|
|
32
40
|
verify(): Promise<void>;
|
|
33
|
-
reverted: boolean;
|
|
34
41
|
revert(): Promise<void>;
|
|
42
|
+
doTree(level: number): Promise<void>;
|
|
43
|
+
tree(): Promise<void>;
|
|
35
44
|
}
|
|
36
45
|
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/core/migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/core/migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAYxC,MAAM,WAAW,kBAAkB;IACjC,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O,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBrE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAcvB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAepC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
|
package/dist/core/migration.js
CHANGED
|
@@ -6,10 +6,19 @@ const common_1 = require("@art-ws/common");
|
|
|
6
6
|
const fs_utils_1 = require("./fs-utils");
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
+
const pad = (n, s = " ") => {
|
|
10
|
+
let r = "";
|
|
11
|
+
for (let i = 0; i < n; i++) {
|
|
12
|
+
r += s;
|
|
13
|
+
}
|
|
14
|
+
return r;
|
|
15
|
+
};
|
|
9
16
|
class Migration {
|
|
10
17
|
constructor(args) {
|
|
11
18
|
this.args = args;
|
|
12
|
-
|
|
19
|
+
const { name } = args;
|
|
20
|
+
common_1.assert({ name }).string().defined();
|
|
21
|
+
this.name = name;
|
|
13
22
|
}
|
|
14
23
|
get dbAdapter() {
|
|
15
24
|
return this.args.dbAdapter;
|
|
@@ -26,13 +35,24 @@ class Migration {
|
|
|
26
35
|
}
|
|
27
36
|
return this.cfg;
|
|
28
37
|
}
|
|
38
|
+
async includes() {
|
|
39
|
+
const cfg = await this.getConfig();
|
|
40
|
+
return cfg.includes ?? [];
|
|
41
|
+
}
|
|
29
42
|
async requires() {
|
|
30
43
|
const cfg = await this.getConfig();
|
|
31
|
-
|
|
44
|
+
const result = [
|
|
45
|
+
...(cfg.requires ?? cfg.depends ?? []),
|
|
46
|
+
...(cfg.includes ?? []),
|
|
47
|
+
].filter(Boolean);
|
|
48
|
+
return result;
|
|
32
49
|
}
|
|
33
50
|
async getParents() {
|
|
34
51
|
return (await this.requires()).map((x) => this.args.resolver.resolve(x));
|
|
35
52
|
}
|
|
53
|
+
async getIncludes() {
|
|
54
|
+
return (await this.includes()).map((x) => this.args.resolver.resolve(x));
|
|
55
|
+
}
|
|
36
56
|
isApplied() {
|
|
37
57
|
return this.dbAdapter.hasPatch(this.name);
|
|
38
58
|
}
|
|
@@ -43,54 +63,77 @@ class Migration {
|
|
|
43
63
|
return [];
|
|
44
64
|
const ls = fs_utils_1.getFiles(dir);
|
|
45
65
|
ls.sort();
|
|
66
|
+
const isIgnore = (s) => s.startsWith("_") || s.startsWith(".");
|
|
46
67
|
const result = ls
|
|
47
|
-
.filter((x) => !(x
|
|
68
|
+
.filter((x) => !isIgnore(x) && x.endsWith(".sql"))
|
|
48
69
|
.map((x) => path_1.default.join(dir, x));
|
|
49
70
|
return result;
|
|
50
71
|
}
|
|
51
|
-
async
|
|
52
|
-
if (this.
|
|
53
|
-
|
|
54
|
-
if (await this.isApplied()) {
|
|
55
|
-
console.log(chalk_1.default.green(`Patch '${this.name}' already deployed.`));
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
for await (const p of await this.getParents()) {
|
|
59
|
-
await p.deploy();
|
|
72
|
+
async doOnce(fn) {
|
|
73
|
+
if (!this.handled) {
|
|
74
|
+
this.handled = (await fn()) ?? true;
|
|
60
75
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
return this.handled;
|
|
77
|
+
}
|
|
78
|
+
async deploy(args) {
|
|
79
|
+
await this.doOnce(async () => {
|
|
80
|
+
if (await this.isApplied()) {
|
|
81
|
+
console.log(chalk_1.default.green(`Patch '${this.name}' already deployed.`));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
for await (const p of await this.getParents()) {
|
|
85
|
+
await p.deploy(args);
|
|
86
|
+
}
|
|
87
|
+
await this.dbAdapter.execFiles({
|
|
88
|
+
ver: this.name,
|
|
89
|
+
register: !args.noInstall,
|
|
90
|
+
files: await this.getSQLFiles("deploy"),
|
|
91
|
+
dryRun: !!args?.dryRun,
|
|
92
|
+
});
|
|
93
|
+
console.log(chalk_1.default.green(`Deployed patch '${this.name}'`));
|
|
65
94
|
});
|
|
66
|
-
console.log(chalk_1.default.green(`Deployed patch '${this.name}'`));
|
|
67
|
-
this.deployed = true;
|
|
68
95
|
}
|
|
69
96
|
async verify() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
await this.doOnce(async () => {
|
|
98
|
+
console.log(chalk_1.default.grey(`Verify '${this.name}' ...`));
|
|
99
|
+
if (!(await this.isApplied()))
|
|
100
|
+
throw new Error(`Patch '${this.name}' not deployed`);
|
|
101
|
+
for await (const p of await this.getParents()) {
|
|
102
|
+
await p.verify();
|
|
103
|
+
}
|
|
104
|
+
await this.dbAdapter.execFiles({
|
|
105
|
+
files: await this.getSQLFiles("verify"),
|
|
106
|
+
});
|
|
107
|
+
console.log(chalk_1.default.green(`Patch '${this.name}' verify successful`));
|
|
80
108
|
});
|
|
81
|
-
console.log(chalk_1.default.green(`Patch '${this.name}' verify successful`));
|
|
82
|
-
this.verified = true;
|
|
83
109
|
}
|
|
84
110
|
async revert() {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
111
|
+
await this.doOnce(async () => {
|
|
112
|
+
await this.dbAdapter.execFiles({
|
|
113
|
+
ver: this.name,
|
|
114
|
+
unregister: true,
|
|
115
|
+
files: await this.getSQLFiles("revert"),
|
|
116
|
+
});
|
|
117
|
+
for await (const p of await this.getIncludes()) {
|
|
118
|
+
await p.revert();
|
|
119
|
+
}
|
|
120
|
+
console.log(chalk_1.default.green(`Patch '${this.name}' reverted`));
|
|
91
121
|
});
|
|
92
|
-
|
|
93
|
-
|
|
122
|
+
}
|
|
123
|
+
async doTree(level) {
|
|
124
|
+
await this.doOnce(async () => {
|
|
125
|
+
const isApplied = await this.isApplied();
|
|
126
|
+
const color = isApplied ? chalk_1.default.green.bind(chalk_1.default) : chalk_1.default.red.bind(chalk_1.default);
|
|
127
|
+
console.log(color(`${pad(level, " ")}'${this.name}'`) +
|
|
128
|
+
chalk_1.default.white(" - ") +
|
|
129
|
+
chalk_1.default.grey(this.cwd));
|
|
130
|
+
for await (const p of await this.getParents()) {
|
|
131
|
+
await p.doTree(level + 1);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async tree() {
|
|
136
|
+
await this.doTree(0);
|
|
94
137
|
}
|
|
95
138
|
}
|
|
96
139
|
exports.Migration = Migration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/core/migration.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/core/migration.ts"],"names":[],"mappings":";;;;AAAA,2CAAqE;AAErE,yCAAkD;AAClD,wDAAuB;AACvB,0DAAyB;AAEzB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,IAAY,GAAG,EAAU,EAAE;IACjD,IAAI,CAAC,GAAG,EAAE,CAAA;IACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,CAAC,IAAI,CAAC,CAAA;KACP;IACD,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAUD,MAAa,SAAS;IAIpB,YACS,IAKN;QALM,SAAI,GAAJ,IAAI,CAKV;QAED,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;QACrB,eAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,IAAI,C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AAI,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,UAAU,EAAE,EAAE;gBAC7C,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;aAC1B;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;CACF;AA5JD,8BA4JC"}
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAqB,MAAM,YAAY,CAAA;AAGpD,wBAAsB,IAAI,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAqB,MAAM,YAAY,CAAA;AAGpD,wBAAsB,IAAI,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,iBAiB3D"}
|
package/dist/main.js
CHANGED
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;AAAA,6CAA6C;AAC7C,yCAAoD;AACpD,0DAAyB;AAElB,KAAK,UAAU,IAAI,CAAC,IAAiC;IAC1D,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC1B,MAAM,YAAY,GAAG,6BAAe,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,CAAA;IACpC,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,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AI,CAAC,CAAA;QACxC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KACvB;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,CAAC,GAAG,GAAY,CAAA;QACtB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;QACnC,MAAM,CAAC,CAAA;KACR;AACH,CAAC;AAjBD,oBAiBC"}
|
|
@@ -9,6 +9,7 @@ export interface PgDbConnection {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class PgDbAdapter extends DbAdapter {
|
|
11
11
|
args: {
|
|
12
|
+
env: string;
|
|
12
13
|
connection: PgDbConnection;
|
|
13
14
|
};
|
|
14
15
|
cfg: ClientConfig;
|
|
@@ -16,8 +17,11 @@ export declare class PgDbAdapter extends DbAdapter {
|
|
|
16
17
|
table: string;
|
|
17
18
|
pool: Pool;
|
|
18
19
|
constructor(args: {
|
|
20
|
+
env: string;
|
|
19
21
|
connection: PgDbConnection;
|
|
20
22
|
});
|
|
23
|
+
getEnvName(): string;
|
|
24
|
+
getConfig<T>(): T;
|
|
21
25
|
private getClientConfig;
|
|
22
26
|
getPool(): Promise<Pool>;
|
|
23
27
|
get fullTableName(): string;
|
|
@@ -39,12 +43,14 @@ export declare class PgDbAdapter extends DbAdapter {
|
|
|
39
43
|
checksum?: string;
|
|
40
44
|
}): Promise<void>;
|
|
41
45
|
unregisterPatch(ver: string): Promise<void>;
|
|
46
|
+
cat(file: string): Promise<void>;
|
|
42
47
|
execFiles(args: {
|
|
43
48
|
ver?: string;
|
|
44
49
|
register?: boolean;
|
|
45
50
|
unregister?: boolean;
|
|
46
51
|
note?: string;
|
|
47
52
|
files: string[];
|
|
53
|
+
dryRun?: boolean;
|
|
48
54
|
}): Promise<void>;
|
|
49
55
|
list(): Promise<IDbPatchEntry[]>;
|
|
50
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg-db-adapter.d.ts","sourceRoot":"","sources":["../../src/pg/pg-db-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAG7D,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAgBD,qBAAa,WAAY,SAAQ,SAAS;IAMrB,IAAI,EAAE;QAAE,UAAU,EAAE,cAAc,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"pg-db-adapter.d.ts","sourceRoot":"","sources":["../../src/pg/pg-db-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAG7D,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAgBD,qBAAa,WAAY,SAAQ,SAAS;IAMrB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,cAAc,CAAA;KAAE;IALpE,GAAG,EAAE,YAAY,CAAA;IACjB,MAAM,SAAW;IACjB,KAAK,SAAY;IACjB,IAAI,EAAE,IAAI,CAAA;gBAES,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,cAAc,CAAA;KAAE;IAKpE,UAAU,IAAI,MAAM;IAIpB,SAAS,CAAC,CAAC,KAAK,CAAC;IAIjB,OAAO,CAAC,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ema }) => `
|
|
10
10
|
CREATE TABLE ${schema}.${table} (
|
|
11
11
|
id serial NOT NULL,
|
|
12
|
-
ver
|
|
13
|
-
|
|
14
|
-
note
|
|
15
|
-
checksum
|
|
12
|
+
ver text NOT NULL,
|
|
13
|
+
at timestamptz NOT NULL DEFAULT now(),
|
|
14
|
+
note text NULL,
|
|
15
|
+
checksum text NULL,
|
|
16
16
|
CONSTRAINT ${table}_pkey PRIMARY KEY (id),
|
|
17
17
|
CONSTRAINT ${table}_unique_ver UNIQUE (ver)
|
|
18
18
|
)
|
|
@@ -26,6 +26,12 @@ class PgDbAdapter extends db_adapter_1.DbAdapter {
|
|
|
26
26
|
this.table = "_db_evo";
|
|
27
27
|
this.cfg = this.getClientConfig();
|
|
28
28
|
}
|
|
29
|
+
getEnvName() {
|
|
30
|
+
return this.args.env ?? "";
|
|
31
|
+
}
|
|
32
|
+
getConfig() {
|
|
33
|
+
return this.cfg;
|
|
34
|
+
}
|
|
29
35
|
getClientConfig() {
|
|
30
36
|
const { connection: c } = this.args;
|
|
31
37
|
const result = {
|
|
@@ -66,7 +72,8 @@ class PgDbAdapter extends db_adapter_1.DbAdapter {
|
|
|
66
72
|
try {
|
|
67
73
|
await this.checkConnection();
|
|
68
74
|
}
|
|
69
|
-
catch (
|
|
75
|
+
catch (err) {
|
|
76
|
+
const e = err;
|
|
70
77
|
if (e.code === "3D000") {
|
|
71
78
|
await this.createDb();
|
|
72
79
|
}
|
|
@@ -110,19 +117,29 @@ class PgDbAdapter extends db_adapter_1.DbAdapter {
|
|
|
110
117
|
common_1.assert({ ver }).defined().string();
|
|
111
118
|
await this.execSQL(`delete from ${this.fullTableName} where ver = ${q(ver)}`);
|
|
112
119
|
}
|
|
120
|
+
async cat(file) {
|
|
121
|
+
console.log(file);
|
|
122
|
+
}
|
|
113
123
|
async execFiles(args) {
|
|
114
124
|
if (args.register || args.unregister) {
|
|
115
125
|
common_1.assert({ ver: args.ver }).defined().string();
|
|
116
126
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (args.register) {
|
|
122
|
-
await this.registerPatch({ ver: args.ver, note: args.note });
|
|
127
|
+
if (args.dryRun) {
|
|
128
|
+
for (const file of args.files) {
|
|
129
|
+
await this.cat(file);
|
|
130
|
+
}
|
|
123
131
|
}
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
else {
|
|
133
|
+
const psql = new psql_adapter_1.PSqlAdapter(this.cfg);
|
|
134
|
+
for (const file of args.files) {
|
|
135
|
+
await psql.execFile(file);
|
|
136
|
+
}
|
|
137
|
+
if (args.register) {
|
|
138
|
+
await this.registerPatch({ ver: args.ver, note: args.note });
|
|
139
|
+
}
|
|
140
|
+
if (args.unregister) {
|
|
141
|
+
await this.unregisterPatch(args.ver);
|
|
142
|
+
}
|
|
126
143
|
}
|
|
127
144
|
}
|
|
128
145
|
list() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg-db-adapter.js","sourceRoot":"","sources":["../../src/pg/pg-db-adapter.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,2BAAuC;AACvC,mDAA6D;AAC7D,iDAA4C;AAU5C,MAAM,CAAC,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhD,MAAM,WAAW,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;eAC5B,MAAM,IAAI,KAAK;;;;;;eAMf,KAAK;cACN,KAAK;;CAElB,CAAA;AACD,6BAA6B;AAC7B,MAAa,WAAY,SAAQ,sBAAS;IAMxC,YAAmB,
|
|
1
|
+
{"version":3,"file":"pg-db-adapter.js","sourceRoot":"","sources":["../../src/pg/pg-db-adapter.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,2BAAuC;AACvC,mDAA6D;AAC7D,iDAA4C;AAU5C,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,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;aAC7D;YACD,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;aACrC;SACF;IACH,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,IAAI,CAAC,aAAa,cAAc,CAAC,CAAA;IACxE,CAAC;CACF;AAtKD,kCAsKC"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "db-evo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "art-ws.com DB evolutions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"art-ws",
|
|
7
|
+
"database",
|
|
8
|
+
"db",
|
|
9
|
+
"postgres",
|
|
10
|
+
"pg",
|
|
11
|
+
"migrations"
|
|
12
|
+
],
|
|
5
13
|
"homepage": "https://github.com/art-ws/db-evo",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/art-ws/db-evo/issues",
|
|
16
|
+
"email": "art-ws@pm.me"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/art-ws/db-evo.git"
|
|
21
|
+
},
|
|
6
22
|
"license": "MIT",
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "art-ws Team",
|
|
25
|
+
"email": "art-ws@pm.me",
|
|
26
|
+
"url": "https://art-ws.org"
|
|
27
|
+
},
|
|
7
28
|
"main": "dist/index.js",
|
|
8
29
|
"types": "dist/index.d.ts",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
11
|
-
"watch": "tsc --watch",
|
|
12
|
-
"clean": "rimraf dist coverage *.tgz *.tsbuildinfo *.log",
|
|
13
|
-
"lint": "eslint --fix --ext .ts .",
|
|
14
|
-
"test": "jest",
|
|
15
|
-
"fmt": "prettier --write .",
|
|
16
|
-
"link": "sudo pnpm link",
|
|
17
|
-
"unlink": "sudo pnpm unlink",
|
|
18
|
-
"pack": "pnpm pack",
|
|
19
|
-
"ncu": "pnpx ncu",
|
|
20
|
-
"upgrade": "pnpx ncu -u",
|
|
21
|
-
"madge": "pnpx madge --circular --extensions ts .",
|
|
22
|
-
"cti": "pnpx cti -n -b -v ./src"
|
|
23
|
-
},
|
|
24
30
|
"bin": {
|
|
25
31
|
"db-evo": "bin/index.js"
|
|
26
32
|
},
|
|
@@ -28,47 +34,23 @@
|
|
|
28
34
|
"bin",
|
|
29
35
|
"dist"
|
|
30
36
|
],
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">=14"
|
|
33
|
-
},
|
|
34
|
-
"author": {
|
|
35
|
-
"email": "art-ws@pm.me",
|
|
36
|
-
"name": "art-ws Team",
|
|
37
|
-
"url": "https://art-ws.org"
|
|
38
|
-
},
|
|
39
|
-
"bugs": {
|
|
40
|
-
"url": "https://github.com/art-ws/db-evo/issues",
|
|
41
|
-
"email": "art-ws@pm.me"
|
|
42
|
-
},
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "https://github.com/art-ws/db-evo.git"
|
|
46
|
-
},
|
|
47
|
-
"keywords": [
|
|
48
|
-
"art-ws",
|
|
49
|
-
"database",
|
|
50
|
-
"db",
|
|
51
|
-
"postgres",
|
|
52
|
-
"pg",
|
|
53
|
-
"migrations"
|
|
54
|
-
],
|
|
55
37
|
"dependencies": {
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"fs-extra": "9.1.0",
|
|
59
|
-
"@types/fs-extra": "9.0.7",
|
|
60
|
-
"cosmiconfig": "7.0.0",
|
|
38
|
+
"@art-ws/common": "latest",
|
|
39
|
+
"@types/chalk": "0.4.31",
|
|
61
40
|
"@types/cosmiconfig": "5.0.3",
|
|
62
|
-
"@types/
|
|
63
|
-
"lodash": "4.17.20",
|
|
41
|
+
"@types/fs-extra": "9.0.7",
|
|
64
42
|
"@types/lodash": "4.14.168",
|
|
65
|
-
"@
|
|
66
|
-
"nunjucks": "3.2.2",
|
|
43
|
+
"@types/node": "14.14.27",
|
|
67
44
|
"@types/nunjucks": "3.1.4",
|
|
68
|
-
"pg": "8.5.1",
|
|
69
45
|
"@types/pg": "7.14.9",
|
|
70
46
|
"chalk": "4.1.0",
|
|
71
|
-
"
|
|
47
|
+
"cosmiconfig": "7.0.0",
|
|
48
|
+
"fs-extra": "9.1.0",
|
|
49
|
+
"lodash": "4.17.20",
|
|
50
|
+
"nunjucks": "3.2.2",
|
|
51
|
+
"pg": "8.5.1",
|
|
52
|
+
"tslib": "2.1.0",
|
|
53
|
+
"yargs": "16.2.0"
|
|
72
54
|
},
|
|
73
55
|
"devDependencies": {
|
|
74
56
|
"@art-ws/eslint": "latest",
|
|
@@ -82,6 +64,7 @@
|
|
|
82
64
|
"@typescript-eslint/eslint-plugin": "4.15.0",
|
|
83
65
|
"@typescript-eslint/parser": "4.15.0",
|
|
84
66
|
"chai": "4.3.0",
|
|
67
|
+
"create-ts-index": "1.13.6",
|
|
85
68
|
"eslint": "7.19.0",
|
|
86
69
|
"eslint-config-prettier": "7.2.0",
|
|
87
70
|
"eslint-config-standard-with-typescript": "20.0.0",
|
|
@@ -92,12 +75,34 @@
|
|
|
92
75
|
"eslint-plugin-standard": "4.1.0",
|
|
93
76
|
"jest": "26.6.3",
|
|
94
77
|
"jest-standard-reporter": "2.0.0",
|
|
78
|
+
"madge": "4.0.0",
|
|
79
|
+
"npm-check-updates": "11.1.1",
|
|
95
80
|
"prettier": "2.2.1",
|
|
96
81
|
"rimraf": "3.0.2",
|
|
97
82
|
"ts-jest": "26.5.1",
|
|
98
|
-
"typescript": "4.1.5"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
"
|
|
83
|
+
"typescript": "4.1.5"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": ">=14"
|
|
87
|
+
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"access": "public"
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"build": "tsc",
|
|
93
|
+
"bump": "pnpm version patch --no-git-checks",
|
|
94
|
+
"clean": "rimraf dist coverage *.tgz *.tsbuildinfo *.log",
|
|
95
|
+
"cti": "pnpx cti -n -b -v ./src",
|
|
96
|
+
"fmt": "prettier --write .",
|
|
97
|
+
"link": "sudo pnpm link",
|
|
98
|
+
"lint": "eslint --fix --ext .ts .",
|
|
99
|
+
"madge": "pnpx madge --circular --extensions ts .",
|
|
100
|
+
"ncu": "pnpx ncu",
|
|
101
|
+
"pack": "pnpm pack",
|
|
102
|
+
"pub": "pnpm publish --access public --no-git-checks",
|
|
103
|
+
"test": "jest",
|
|
104
|
+
"unlink": "sudo pnpm unlink",
|
|
105
|
+
"upgrade": "pnpx ncu -u",
|
|
106
|
+
"watch": "tsc --watch"
|
|
102
107
|
}
|
|
103
|
-
}
|
|
108
|
+
}
|