@prisma-psm/core 1.0.5 → 1.0.7
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/.idea/developer-tools.xml +6 -0
- package/README.en.md +189 -0
- package/README.md +98 -99
- package/README.pt.md +196 -0
- package/package.json +9 -6
- package/src/configs.d.ts +2 -0
- package/src/configs.d.ts.map +1 -1
- package/src/configs.ts +2 -0
- package/src/driver.d.ts +78 -6
- package/src/driver.d.ts.map +1 -1
- package/src/driver.ts +95 -6
- package/src/launcher/commands/check.ts +1 -1
- package/src/launcher/commands/{migrate.d.ts → commit.d.ts} +2 -2
- package/src/launcher/commands/commit.d.ts.map +1 -0
- package/src/launcher/commands/{migrate.js → commit.js} +8 -6
- package/src/launcher/commands/commit.js.map +1 -0
- package/src/launcher/commands/{migrate.ts → commit.ts} +7 -6
- package/src/launcher/commands/deploy.d.ts.map +1 -1
- package/src/launcher/commands/deploy.js +11 -3
- package/src/launcher/commands/deploy.js.map +1 -1
- package/src/launcher/commands/deploy.ts +11 -4
- package/src/launcher/commands/generate.d.ts.map +1 -1
- package/src/launcher/commands/generate.js +1 -1
- package/src/launcher/commands/generate.js.map +1 -1
- package/src/launcher/commands/generate.ts +2 -3
- package/src/launcher/index.js +25 -3
- package/src/launcher/index.js.map +1 -1
- package/src/launcher/index.ts +1 -4
- package/src/tools/{migrate.d.ts → commit.d.ts} +2 -2
- package/src/tools/commit.d.ts.map +1 -0
- package/src/tools/{migrate.js → commit.js} +44 -33
- package/src/tools/commit.js.map +1 -0
- package/src/tools/{migrate.ts → commit.ts} +48 -37
- package/src/tools/common.d.ts +14 -0
- package/src/tools/common.d.ts.map +1 -0
- package/src/tools/common.js +70 -0
- package/src/tools/common.js.map +1 -0
- package/src/tools/common.ts +46 -0
- package/src/tools/deploy.d.ts +42 -0
- package/src/tools/deploy.d.ts.map +1 -1
- package/src/tools/deploy.js +161 -0
- package/src/tools/deploy.js.map +1 -1
- package/src/tools/deploy.ts +147 -0
- package/src/tools/generate.d.ts.map +1 -1
- package/src/tools/generate.js +9 -4
- package/src/tools/generate.js.map +1 -1
- package/src/tools/generate.ts +16 -8
- package/src/launcher/commands/migrate.d.ts.map +0 -1
- package/src/launcher/commands/migrate.js.map +0 -1
- package/src/tools/migrate.d.ts.map +0 -1
- package/src/tools/migrate.js.map +0 -1
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import {CommandModule} from "yargs";
|
|
2
|
-
import {DeployOptions} from "../../tools/deploy";
|
|
2
|
+
import { DeployOptions, deploy} from "../../tools/deploy";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const command:CommandModule<DeployOptions, DeployOptions> = {
|
|
6
|
-
command: "
|
|
7
|
-
describe: "Deploy
|
|
6
|
+
command: "deploy",
|
|
7
|
+
describe: "Deploy all commited revision into server",
|
|
8
8
|
builder: args => {
|
|
9
|
+
args.options( "schema", {
|
|
10
|
+
type: "string",
|
|
11
|
+
alias: "s"
|
|
12
|
+
})
|
|
9
13
|
return args;
|
|
10
14
|
},
|
|
11
15
|
handler:( argv) =>{
|
|
12
|
-
|
|
16
|
+
deploy( argv ).then( value => {
|
|
17
|
+
}).catch( reason => {
|
|
18
|
+
console.error( reason );
|
|
19
|
+
})
|
|
13
20
|
}
|
|
14
21
|
}
|
|
15
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAIpC,QAAA,MAAM,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAIpC,QAAA,MAAM,OAAO,EAAC,aASb,CAAA;AAED,SAAS,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":";AACA,mDAA8C;AAG9C,MAAM,OAAO,GAAiB;IAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":";AACA,mDAA8C;AAG9C,MAAM,OAAO,GAAiB;IAC1B,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,+BAA+B;IACzC,OAAO,EAAE,IAAI,CAAC,EAAE;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,EAAE,IAAI,CAAC,EAAE;QACZ,IAAA,mBAAQ,GAAE,CAAA;IACd,CAAC;CACJ,CAAA;AAED,iBAAS,OAAO,CAAC"}
|
|
@@ -3,14 +3,13 @@ import {generate} from "../../tools/generate";
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const command:CommandModule = {
|
|
6
|
-
command: "
|
|
6
|
+
command: "generate",
|
|
7
7
|
describe: "Generate pre-migrate archives",
|
|
8
|
-
|
|
9
8
|
builder: args => {
|
|
10
9
|
return args;
|
|
11
10
|
},
|
|
12
11
|
handler: args => {
|
|
13
|
-
generate()
|
|
12
|
+
generate()
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
|
package/src/launcher/index.js
CHANGED
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
3
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
28
|
};
|
|
6
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
30
|
require("source-map-support").install();
|
|
8
|
-
const
|
|
9
|
-
require("source-map-support").install();
|
|
31
|
+
const Path = __importStar(require("node:path"));
|
|
10
32
|
const yargs_1 = __importDefault(require("yargs"));
|
|
11
33
|
let ss = (0, yargs_1.default)(process.argv.slice(2))
|
|
12
34
|
//language=file-reference
|
|
13
|
-
.commandDir(
|
|
35
|
+
.commandDir(Path.join(__dirname, "./commands"))
|
|
14
36
|
.demandCommand()
|
|
15
37
|
.help()
|
|
16
38
|
.argv;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,EAAE,CAAC;AACxC,gDAAkC;AAClC,kDAA0B;AAE1B,IAAI,EAAE,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,yBAAyB;KACxB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAE,SAAS,EAAE,YAAY,CAAE,CAAE;KACjD,aAAa,EAAE;KACf,IAAI,EAAE;KACN,IAAI,CAAC"}
|
package/src/launcher/index.ts
CHANGED
|
@@ -4,5 +4,5 @@ export interface MigrateOptions {
|
|
|
4
4
|
label?: string;
|
|
5
5
|
"generate-command": string;
|
|
6
6
|
}
|
|
7
|
-
export declare function
|
|
8
|
-
//# sourceMappingURL=
|
|
7
|
+
export declare function commit(opts: MigrateOptions): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["commit.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,cAAc;IAC3B,MAAM,CAAC,EAAC,MAAM,CAAA;IACd,QAAQ,CAAC,EAAC,MAAM,CAAA;IAChB,KAAK,CAAC,EAAC,MAAM,CAAA;IACb,kBAAkB,EAAC,MAAM,CAAA;CAC5B;AACD,wBAAsB,MAAM,CAAC,IAAI,EAAC,cAAc,iBA+F/C"}
|
|
@@ -31,20 +31,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
34
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
38
|
+
exports.commit = commit;
|
|
36
39
|
const fs = __importStar(require("node:fs"));
|
|
37
|
-
const yaml = __importStar(require("yaml"));
|
|
38
40
|
const Path = __importStar(require("node:path"));
|
|
41
|
+
const yaml = __importStar(require("yaml"));
|
|
39
42
|
const node_child_process_1 = require("node:child_process");
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function migrate(opts) {
|
|
43
|
+
const deploy_1 = require("./deploy");
|
|
44
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
45
|
+
const common_1 = require("./common");
|
|
46
|
+
function commit(opts) {
|
|
45
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
48
|
require('dotenv').config();
|
|
47
|
-
console.log(opts);
|
|
48
49
|
if (opts.generate) {
|
|
49
50
|
let command = opts["generate-command"];
|
|
50
51
|
if (!command)
|
|
@@ -53,44 +54,48 @@ function migrate(opts) {
|
|
|
53
54
|
cwd: process.cwd()
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
if (!schema) {
|
|
58
|
-
schema = prisma.find(value => {
|
|
59
|
-
return fs.existsSync(value);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
if (!schema) {
|
|
63
|
-
return console.error("Migrate error: schema.prisma file not found!");
|
|
64
|
-
}
|
|
65
|
-
console.log(`PSM migrate base do schema ${schema}`);
|
|
66
|
-
const home = Path.dirname(schema);
|
|
67
|
-
const psm_yml = Path.join(home, "psm.yml");
|
|
68
|
-
if (!fs.existsSync(psm_yml)) {
|
|
69
|
-
return console.error("Migrate error: psm.yml file not found!");
|
|
70
|
-
}
|
|
71
|
-
console.log(`PSM migrate using ${psm_yml}`);
|
|
72
|
-
const psm = yaml.parse(fs.readFileSync(psm_yml).toString());
|
|
57
|
+
const { psm, psm_sql, driver, home } = yield (0, common_1.psmLockup)({ schema: opts.schema });
|
|
73
58
|
const next = Path.join(psm.psm.output, "next/migration.next.sql");
|
|
74
59
|
const check = Path.join(psm.psm.output, "next/migration.next.check.sql");
|
|
75
60
|
if (!fs.existsSync(check)) {
|
|
76
|
-
|
|
61
|
+
throw new Error("Migrate error: next/migration.next.check.sql file not found!");
|
|
77
62
|
}
|
|
78
63
|
if (!fs.existsSync(next)) {
|
|
79
|
-
|
|
64
|
+
throw new Error("Migrate error: next/migration.next.sql file not found!");
|
|
80
65
|
}
|
|
81
|
-
const driver = yield Promise.resolve(`${psm.psm.driver}`).then(s => __importStar(require(s)));
|
|
82
66
|
const migrator = driver.migrator({
|
|
83
67
|
url: process.env[psm.psm.url],
|
|
84
68
|
migrate: fs.readFileSync(next).toString(),
|
|
85
69
|
check: fs.readFileSync(check).toString(),
|
|
70
|
+
core: fs.readFileSync(psm_sql).toString(),
|
|
86
71
|
});
|
|
87
|
-
let result = yield migrator.
|
|
72
|
+
let result = yield migrator.core();
|
|
88
73
|
if (!result.success) {
|
|
89
74
|
console.error(result.error);
|
|
90
75
|
result.messages.forEach(error => {
|
|
91
76
|
console.error(error);
|
|
92
77
|
});
|
|
93
|
-
|
|
78
|
+
throw new Error("Migrate error: Core failed!");
|
|
79
|
+
}
|
|
80
|
+
const fetchResponse = yield (0, deploy_1.fetch)({
|
|
81
|
+
psm: psm,
|
|
82
|
+
driver: driver,
|
|
83
|
+
home: home
|
|
84
|
+
});
|
|
85
|
+
if (fetchResponse.error) {
|
|
86
|
+
throw fetchResponse.error;
|
|
87
|
+
}
|
|
88
|
+
const noPulled = fetchResponse.revs.filter(n => !n.pulled);
|
|
89
|
+
if (noPulled.length) {
|
|
90
|
+
throw new Error(`Commit not pulled already exists! Please run ${chalk_1.default.bold("psm deploy")} first!`);
|
|
91
|
+
}
|
|
92
|
+
result = yield migrator.test();
|
|
93
|
+
if (!result.success) {
|
|
94
|
+
console.error(result.error);
|
|
95
|
+
result.messages.forEach(error => {
|
|
96
|
+
console.error(error);
|
|
97
|
+
});
|
|
98
|
+
throw new Error("Migrate error: Check shadow failed!");
|
|
94
99
|
}
|
|
95
100
|
result = yield migrator.migrate();
|
|
96
101
|
if (!result.success) {
|
|
@@ -98,15 +103,21 @@ function migrate(opts) {
|
|
|
98
103
|
result.messages.forEach(error => {
|
|
99
104
|
console.error(error);
|
|
100
105
|
});
|
|
101
|
-
|
|
106
|
+
throw new Error("Migrate error: Commit migration failed!");
|
|
102
107
|
}
|
|
103
108
|
const moment = require('moment');
|
|
104
109
|
let label = "";
|
|
105
110
|
if (!!opts.label)
|
|
106
111
|
label = ` - ${sanitizeLabel(opts.label)}`;
|
|
112
|
+
let preview;
|
|
113
|
+
const last = getLatestFolder(Path.join(home, `psm/revisions/schema`));
|
|
114
|
+
if (!!last) {
|
|
115
|
+
preview = yaml.parse(fs.readFileSync(Path.join(home, "psm/revisions/schema", last, "psm.yml")).toString());
|
|
116
|
+
}
|
|
107
117
|
psm.migration = {
|
|
118
|
+
revision: `${moment().format('YYYYMMDDHHmmss')} - ${psm.psm.migration}`,
|
|
108
119
|
instate: moment().format('YYYYMMDDHHmmss'),
|
|
109
|
-
preview:
|
|
120
|
+
preview: preview === null || preview === void 0 ? void 0 : preview.migration.revision,
|
|
110
121
|
label: opts.label
|
|
111
122
|
};
|
|
112
123
|
const nextRev = Path.join(home, `psm/revisions/schema/${psm.migration.instate}${label}`);
|
|
@@ -134,4 +145,4 @@ function sanitizeLabel(label) {
|
|
|
134
145
|
.trim()
|
|
135
146
|
.replace(/\s+/g, ' '); // normaliza espaços
|
|
136
147
|
}
|
|
137
|
-
//# sourceMappingURL=
|
|
148
|
+
//# sourceMappingURL=commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["commit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wBA+FC;AA/GD,4CAA8B;AAC9B,gDAAkC;AAClC,2CAA6B;AAE7B,2DAA+C;AAC/C,qCAA+B;AAC/B,kDAA0B;AAC1B,qCAAmC;AASnC,SAAsB,MAAM,CAAC,IAAmB;;QAC5C,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAG,CAAC;YACjB,IAAI,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACvC,IAAI,CAAC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CAAyC;SAC/E,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAE,yCAAyC;SAC/E,IAAI,EAAE;SACN,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAiB,oBAAoB;AACnE,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
|
-
import * as yaml from "yaml";
|
|
3
2
|
import * as Path from "node:path";
|
|
3
|
+
import * as yaml from "yaml";
|
|
4
4
|
import {PSMConfigFile} from "../configs";
|
|
5
|
-
import {PSMDriver} from "../driver";
|
|
6
5
|
import { spawnSync } from "node:child_process";
|
|
7
|
-
import
|
|
6
|
+
import {fetch} from "./deploy";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import {psmLockup} from "./common";
|
|
8
9
|
|
|
9
|
-
const prisma = [
|
|
10
|
-
`${process.cwd()}/schema.prisma`,
|
|
11
|
-
`${process.cwd()}/prisma/schema.prisma`,
|
|
12
|
-
];
|
|
13
10
|
|
|
14
11
|
export interface MigrateOptions {
|
|
15
12
|
schema?:string
|
|
@@ -17,9 +14,8 @@ export interface MigrateOptions {
|
|
|
17
14
|
label?:string
|
|
18
15
|
"generate-command":string
|
|
19
16
|
}
|
|
20
|
-
export async function
|
|
17
|
+
export async function commit(opts:MigrateOptions ) {
|
|
21
18
|
require('dotenv').config();
|
|
22
|
-
console.log( opts )
|
|
23
19
|
if( opts.generate ) {
|
|
24
20
|
let command = opts["generate-command"];
|
|
25
21
|
if( !command) command = "prisma generate"
|
|
@@ -27,68 +23,83 @@ export async function migrate( opts:MigrateOptions ) {
|
|
|
27
23
|
cwd: process.cwd()
|
|
28
24
|
});
|
|
29
25
|
}
|
|
30
|
-
let schema = opts.schema;
|
|
31
|
-
if( !schema ) {
|
|
32
|
-
schema = prisma.find( value => {
|
|
33
|
-
return fs.existsSync( value );
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
if( !schema ) {
|
|
37
|
-
return console.error( "Migrate error: schema.prisma file not found!" );
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.log(`PSM migrate base do schema ${schema}`);
|
|
41
|
-
|
|
42
|
-
const home = Path.dirname( schema );
|
|
43
|
-
const psm_yml = Path.join( home, "psm.yml" );
|
|
44
|
-
if( !fs.existsSync( psm_yml ) ) {
|
|
45
|
-
return console.error( "Migrate error: psm.yml file not found!" );
|
|
46
|
-
}
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
const psm = yaml.parse( fs.readFileSync( psm_yml ).toString() ) as PSMConfigFile;
|
|
27
|
+
const { psm, psm_sql, driver, home } = await psmLockup({ schema: opts.schema });
|
|
50
28
|
const next = Path.join( psm.psm.output, "next/migration.next.sql");
|
|
51
29
|
const check = Path.join( psm.psm.output, "next/migration.next.check.sql");
|
|
52
30
|
|
|
53
31
|
if( !fs.existsSync( check) ) {
|
|
54
|
-
|
|
32
|
+
throw new Error( "Migrate error: next/migration.next.check.sql file not found!" );
|
|
55
33
|
}
|
|
56
34
|
if( !fs.existsSync( next) ) {
|
|
57
|
-
|
|
35
|
+
throw new Error( "Migrate error: next/migration.next.sql file not found!" );
|
|
58
36
|
}
|
|
59
37
|
|
|
60
38
|
|
|
61
|
-
const driver = await import( psm.psm.driver ) as PSMDriver;
|
|
62
39
|
const migrator = driver.migrator({
|
|
63
|
-
url: process.env[psm.psm.url],
|
|
40
|
+
url: process.env[ psm.psm.url ],
|
|
64
41
|
migrate: fs.readFileSync( next ).toString(),
|
|
65
42
|
check: fs.readFileSync( check ).toString(),
|
|
43
|
+
core: fs.readFileSync( psm_sql ).toString(),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
let result = await migrator.core();
|
|
47
|
+
if( !result.success ) {
|
|
48
|
+
console.error( result.error );
|
|
49
|
+
result.messages.forEach( error => {
|
|
50
|
+
console.error( error );
|
|
51
|
+
});
|
|
52
|
+
throw new Error( "Migrate error: Core failed!" );
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const fetchResponse = await fetch({
|
|
56
|
+
psm: psm,
|
|
57
|
+
driver: driver,
|
|
58
|
+
home: home
|
|
66
59
|
});
|
|
67
60
|
|
|
68
|
-
|
|
61
|
+
if( fetchResponse.error ) {
|
|
62
|
+
throw fetchResponse.error;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const noPulled = fetchResponse.revs.filter( n=> !n.pulled );
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if( noPulled.length ) {
|
|
69
|
+
throw new Error( `Commit not pulled already exists! Please run ${chalk.bold("psm deploy")} first!` );
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
result = await migrator.test();
|
|
69
73
|
if( !result.success ) {
|
|
70
74
|
console.error( result.error );
|
|
71
75
|
result.messages.forEach( error => {
|
|
72
76
|
console.error( error );
|
|
73
77
|
});
|
|
74
|
-
|
|
78
|
+
throw new Error( "Migrate error: Check shadow failed!" );
|
|
75
79
|
}
|
|
76
80
|
|
|
81
|
+
|
|
77
82
|
result = await migrator.migrate();
|
|
78
83
|
if( !result.success ) {
|
|
79
84
|
console.error( result.error );
|
|
80
85
|
result.messages.forEach( error => {
|
|
81
86
|
console.error( error );
|
|
82
87
|
});
|
|
83
|
-
|
|
88
|
+
throw new Error( "Migrate error: Commit migration failed!" );
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
const moment = require('moment');
|
|
87
92
|
let label = "";
|
|
88
|
-
if( !!opts.label ) label = ` - ${sanitizeLabel( opts.label )}
|
|
93
|
+
if( !!opts.label ) label = ` - ${sanitizeLabel( opts.label )}`;
|
|
94
|
+
let preview:PSMConfigFile;
|
|
95
|
+
const last = getLatestFolder( Path.join( home, `psm/revisions/schema`));
|
|
96
|
+
if( !!last ){
|
|
97
|
+
preview = yaml.parse( fs.readFileSync( Path.join( home, "psm/revisions/schema", last, "psm.yml")).toString() ) as PSMConfigFile;
|
|
98
|
+
}
|
|
89
99
|
psm.migration = {
|
|
100
|
+
revision: `${ moment().format( 'YYYYMMDDHHmmss' ) } - ${psm.psm.migration}`,
|
|
90
101
|
instate: moment().format( 'YYYYMMDDHHmmss' ),
|
|
91
|
-
preview:
|
|
102
|
+
preview: preview?.migration.revision,
|
|
92
103
|
label: opts.label
|
|
93
104
|
}
|
|
94
105
|
const nextRev = Path.join( home, `psm/revisions/schema/${psm.migration.instate}${label}`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PSMConfigFile } from "../configs";
|
|
2
|
+
import { PSMDriver } from "../driver";
|
|
3
|
+
export interface CommonSchema {
|
|
4
|
+
schema: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function psmLockup(opts: CommonSchema): Promise<{
|
|
7
|
+
schema: string;
|
|
8
|
+
psm_yml: string;
|
|
9
|
+
psm_sql: string;
|
|
10
|
+
psm: PSMConfigFile;
|
|
11
|
+
driver: PSMDriver;
|
|
12
|
+
home: string;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AASpC,MAAM,WAAW,YAAY;IACzB,MAAM,EAAC,MAAM,CAAA;CAChB;AACD,wBAAsB,SAAS,CAAE,IAAI,EAAC,YAAY;;;;;;;GA6BjD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.psmLockup = psmLockup;
|
|
36
|
+
const fs = __importStar(require("node:fs"));
|
|
37
|
+
const Path = __importStar(require("node:path"));
|
|
38
|
+
const yaml = __importStar(require("yaml"));
|
|
39
|
+
const prisma = [
|
|
40
|
+
`${process.cwd()}/schema.prisma`,
|
|
41
|
+
`${process.cwd()}/prisma/schema.prisma`,
|
|
42
|
+
];
|
|
43
|
+
function psmLockup(opts) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let schema = opts.schema;
|
|
46
|
+
if (!schema) {
|
|
47
|
+
schema = prisma.find(value => {
|
|
48
|
+
return fs.existsSync(value);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (!schema) {
|
|
52
|
+
throw new Error("Migrate error: schema.prisma file not found!");
|
|
53
|
+
}
|
|
54
|
+
console.log(`PSM migrate base do schema ${schema}`);
|
|
55
|
+
const home = Path.dirname(schema);
|
|
56
|
+
const psm_yml = Path.join(home, "psm.yml");
|
|
57
|
+
const psm_sql = Path.join(home, "psm.sql");
|
|
58
|
+
if (!fs.existsSync(psm_yml)) {
|
|
59
|
+
throw new Error("Migrate error: psm.yml file not found!");
|
|
60
|
+
}
|
|
61
|
+
if (!fs.existsSync(psm_sql)) {
|
|
62
|
+
throw new Error("Migrate error: psm.sql file not found!");
|
|
63
|
+
}
|
|
64
|
+
console.log(`PSM migrate using ${psm_yml}`);
|
|
65
|
+
const psm = yaml.parse(fs.readFileSync(psm_yml).toString());
|
|
66
|
+
const driver = yield Promise.resolve(`${psm.psm.driver}`).then(s => __importStar(require(s)));
|
|
67
|
+
return { schema, psm_yml, psm_sql, psm, driver, home };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,8BA6BC;AA7CD,4CAA8B;AAC9B,gDAAkC;AAClC,2CAA6B;AAK7B,MAAM,MAAM,GAAG;IACX,GAAG,OAAO,CAAC,GAAG,EAAE,gBAAgB;IAChC,GAAG,OAAO,CAAC,GAAG,EAAE,uBAAuB;CAC1C,CAAC;AAMF,SAAsB,SAAS,CAAE,IAAiB;;QAC9C,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC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1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as Path from "node:path";
|
|
3
|
+
import * as yaml from "yaml";
|
|
4
|
+
import {PSMConfigFile} from "../configs";
|
|
5
|
+
import {PSMDriver} from "../driver";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const prisma = [
|
|
9
|
+
`${process.cwd()}/schema.prisma`,
|
|
10
|
+
`${process.cwd()}/prisma/schema.prisma`,
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export interface CommonSchema {
|
|
15
|
+
schema:string
|
|
16
|
+
}
|
|
17
|
+
export async function psmLockup( opts:CommonSchema ){
|
|
18
|
+
let schema = opts.schema;
|
|
19
|
+
if( !schema ) {
|
|
20
|
+
schema = prisma.find( value => {
|
|
21
|
+
return fs.existsSync( value );
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
if( !schema ) {
|
|
25
|
+
throw new Error ( "Migrate error: schema.prisma file not found!" )
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log(`PSM migrate base do schema ${schema}`);
|
|
29
|
+
|
|
30
|
+
const home = Path.dirname( schema );
|
|
31
|
+
const psm_yml = Path.join( home, "psm.yml" );
|
|
32
|
+
const psm_sql = Path.join( home, "psm.sql");
|
|
33
|
+
if( !fs.existsSync( psm_yml ) ) {
|
|
34
|
+
throw new Error( "Migrate error: psm.yml file not found!" );
|
|
35
|
+
}
|
|
36
|
+
if( !fs.existsSync( psm_sql ) ) {
|
|
37
|
+
throw new Error( "Migrate error: psm.sql file not found!" );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log(`PSM migrate using ${psm_yml}`);
|
|
41
|
+
const psm = yaml.parse( fs.readFileSync( psm_yml ).toString() ) as PSMConfigFile;
|
|
42
|
+
|
|
43
|
+
const driver = await import( psm.psm.driver ) as PSMDriver;
|
|
44
|
+
|
|
45
|
+
return { schema, psm_yml, psm_sql, psm, driver, home }
|
|
46
|
+
}
|
package/src/tools/deploy.d.ts
CHANGED
|
@@ -1,7 +1,49 @@
|
|
|
1
|
+
import { PSMConfigFile } from "../configs";
|
|
2
|
+
import { PSMDriver } from "../driver";
|
|
1
3
|
export interface DeployOptions {
|
|
2
4
|
schema?: string;
|
|
3
5
|
generate?: string;
|
|
4
6
|
label?: string;
|
|
5
7
|
"generate-command": string;
|
|
6
8
|
}
|
|
9
|
+
export declare function deploy(opts: DeployOptions): Promise<void>;
|
|
10
|
+
export interface FetchOptions {
|
|
11
|
+
home: string;
|
|
12
|
+
driver: PSMDriver;
|
|
13
|
+
psm: PSMConfigFile;
|
|
14
|
+
}
|
|
15
|
+
export declare function fetch(opts: FetchOptions): Promise<{
|
|
16
|
+
error: Error;
|
|
17
|
+
revs: {
|
|
18
|
+
psm: PSMConfigFile;
|
|
19
|
+
migrate: string;
|
|
20
|
+
pulled: boolean;
|
|
21
|
+
label: string;
|
|
22
|
+
message: string[];
|
|
23
|
+
date: Date;
|
|
24
|
+
}[];
|
|
25
|
+
hint?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
error: Error;
|
|
28
|
+
hint: any;
|
|
29
|
+
revs: {
|
|
30
|
+
psm: PSMConfigFile;
|
|
31
|
+
migrate: string;
|
|
32
|
+
pulled: boolean;
|
|
33
|
+
label: string;
|
|
34
|
+
message: string[];
|
|
35
|
+
date: Date;
|
|
36
|
+
}[];
|
|
37
|
+
} | {
|
|
38
|
+
revs: {
|
|
39
|
+
psm: PSMConfigFile;
|
|
40
|
+
migrate: string;
|
|
41
|
+
pulled: boolean;
|
|
42
|
+
label: string;
|
|
43
|
+
message: string[];
|
|
44
|
+
date: Date;
|
|
45
|
+
}[];
|
|
46
|
+
error?: undefined;
|
|
47
|
+
hint?: undefined;
|
|
48
|
+
}>;
|
|
7
49
|
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["deploy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AAGpC,MAAM,WAAW,aAAa;IAC1B,MAAM,CAAC,EAAC,MAAM,CAAA;IACd,QAAQ,CAAC,EAAC,MAAM,CAAA;IAChB,KAAK,CAAC,EAAC,MAAM,CAAA;IACb,kBAAkB,EAAC,MAAM,CAAA;CAC5B;AAID,wBAAsB,MAAM,CAAE,IAAI,EAAE,aAAa,iBAyDhD;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAC,MAAM,CAAC;IACZ,MAAM,EAAC,SAAS,CAAC;IACjB,GAAG,EAAC,aAAa,CAAA;CACpB;AACD,wBAAsB,KAAK,CAAC,IAAI,EAAC,YAAY;;;;;;;iBAahB,MAAM,EAAE;cACP,IAAI;;;;;;;;;;;iBADL,MAAM,EAAE;cACP,IAAI;;;;;;;;iBADL,MAAM,EAAE;cACP,IAAI;;;;GAyDjC"}
|