@prisma-psm/core 1.0.6 → 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 +5 -5
- package/README.md +5 -5
- package/README.pt.md +1 -1
- package/package.json +4 -4
- package/src/driver.d.ts +53 -0
- package/src/driver.d.ts.map +1 -1
- package/src/driver.ts +62 -2
- package/src/launcher/commands/check.ts +1 -1
- package/src/launcher/commands/commit.d.ts +1 -1
- package/src/launcher/commands/commit.d.ts.map +1 -1
- package/src/launcher/commands/commit.js +2 -2
- package/src/launcher/commands/commit.js.map +1 -1
- package/src/launcher/commands/commit.ts +2 -2
- package/src/launcher/commands/generate.js.map +1 -1
- package/src/launcher/commands/generate.ts +1 -1
- 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} +28 -35
- package/src/tools/commit.js.map +1 -0
- package/src/tools/{migrate.ts → commit.ts} +29 -38
- 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 +41 -0
- package/src/tools/deploy.d.ts.map +1 -1
- package/src/tools/deploy.js +72 -62
- package/src/tools/deploy.js.map +1 -1
- package/src/tools/deploy.ts +78 -66
- package/src/tools/generate.d.ts.map +1 -1
- package/src/tools/generate.js.map +1 -1
- package/src/tools/generate.ts +6 -3
- package/src/tools/migrate.d.ts.map +0 -1
- package/src/tools/migrate.js.map +0 -1
|
@@ -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,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EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;IAC1D,CAAC;CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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,3 +1,5 @@
|
|
|
1
|
+
import { PSMConfigFile } from "../configs";
|
|
2
|
+
import { PSMDriver } from "../driver";
|
|
1
3
|
export interface DeployOptions {
|
|
2
4
|
schema?: string;
|
|
3
5
|
generate?: string;
|
|
@@ -5,4 +7,43 @@ export interface DeployOptions {
|
|
|
5
7
|
"generate-command": string;
|
|
6
8
|
}
|
|
7
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
|
+
}>;
|
|
8
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"}
|
package/src/tools/deploy.js
CHANGED
|
@@ -36,42 +36,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.deploy = deploy;
|
|
39
|
+
exports.fetch = fetch;
|
|
39
40
|
const fs = __importStar(require("node:fs"));
|
|
40
41
|
const yaml = __importStar(require("yaml"));
|
|
41
42
|
const Path = __importStar(require("node:path"));
|
|
42
43
|
const chalk_1 = __importDefault(require("chalk"));
|
|
43
|
-
const
|
|
44
|
-
`${process.cwd()}/schema.prisma`,
|
|
45
|
-
`${process.cwd()}/prisma/schema.prisma`,
|
|
46
|
-
];
|
|
44
|
+
const common_1 = require("./common");
|
|
47
45
|
const TAG = "PSM DEPLOY >";
|
|
48
46
|
function deploy(opts) {
|
|
49
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
var _a;
|
|
51
|
-
console.log("Sdsd sd sdsdsds");
|
|
52
48
|
require('dotenv').config();
|
|
53
|
-
|
|
54
|
-
if (!schema) {
|
|
55
|
-
schema = prisma.find(value => {
|
|
56
|
-
return fs.existsSync(value);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (!schema) {
|
|
60
|
-
return console.error("Migrate error: schema.prisma file not found!");
|
|
61
|
-
}
|
|
62
|
-
console.log(`PSM deploy base do schema ${schema}`);
|
|
63
|
-
const home = Path.dirname(schema);
|
|
64
|
-
const psm_yml = Path.join(home, "psm.yml");
|
|
65
|
-
const psm_sql = Path.join(home, "psm.sql");
|
|
66
|
-
if (!fs.existsSync(psm_yml)) {
|
|
67
|
-
return console.error("Migrate error: psm.yml file not found!");
|
|
68
|
-
}
|
|
69
|
-
if (!fs.existsSync(psm_sql)) {
|
|
70
|
-
return console.error("Migrate error: psm.sql file not found!");
|
|
71
|
-
}
|
|
72
|
-
console.log(`PSM migrate using ${psm_yml}`);
|
|
73
|
-
const psm = yaml.parse(fs.readFileSync(psm_yml).toString());
|
|
74
|
-
const driver = yield Promise.resolve(`${psm.psm.driver}`).then(s => __importStar(require(s)));
|
|
49
|
+
const { psm, psm_sql, driver, home } = yield (0, common_1.psmLockup)({ schema: opts.schema });
|
|
75
50
|
let migrator = driver.migrator({
|
|
76
51
|
url: process.env[psm.psm.url],
|
|
77
52
|
migrate: "",
|
|
@@ -84,9 +59,45 @@ function deploy(opts) {
|
|
|
84
59
|
result.messages.forEach(error => {
|
|
85
60
|
console.error(error);
|
|
86
61
|
});
|
|
87
|
-
|
|
62
|
+
throw new Error("Migrate error: Core failed!");
|
|
63
|
+
}
|
|
64
|
+
const pullResponse = yield fetch({
|
|
65
|
+
home: home,
|
|
66
|
+
driver: driver,
|
|
67
|
+
psm: psm
|
|
68
|
+
});
|
|
69
|
+
if (pullResponse.error) {
|
|
70
|
+
throw pullResponse.error;
|
|
71
|
+
}
|
|
72
|
+
const revs = pullResponse.revs;
|
|
73
|
+
for (let i = 0; i < revs.length; i++) {
|
|
74
|
+
let next = revs[i];
|
|
75
|
+
next.message.forEach(console.log);
|
|
76
|
+
if (next.pulled)
|
|
77
|
+
return;
|
|
78
|
+
const migrator = driver.migrator({
|
|
79
|
+
url: process.env[next.psm.psm.url],
|
|
80
|
+
migrate: next.migrate,
|
|
81
|
+
check: "",
|
|
82
|
+
core: "",
|
|
83
|
+
});
|
|
84
|
+
const result = yield migrator.migrate();
|
|
85
|
+
if (!result.success) {
|
|
86
|
+
console.error(result.error);
|
|
87
|
+
result.messages.forEach(error => {
|
|
88
|
+
console.error(error);
|
|
89
|
+
});
|
|
90
|
+
console.error(`${next.label} is migrated at ${next.date} - ${chalk_1.default.redBright.bold("FAILED")}`);
|
|
91
|
+
throw new Error("Migrate error: Push migration failed!");
|
|
92
|
+
}
|
|
93
|
+
console.log(`${next.label} is migrated at ${next.date} - ${chalk_1.default.greenBright.bold("SUCCESS")}`);
|
|
88
94
|
}
|
|
89
|
-
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function fetch(opts) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
var _a;
|
|
100
|
+
const revisions = Path.join(opts.home, `psm/revisions/definition`);
|
|
90
101
|
let revs = fs.readdirSync(revisions)
|
|
91
102
|
.filter(n => fs.statSync(Path.join(revisions, n)).isDirectory())
|
|
92
103
|
.map(n => {
|
|
@@ -94,61 +105,60 @@ function deploy(opts) {
|
|
|
94
105
|
let migrate = fs.readFileSync(Path.join(revisions, n, "migration.sql")).toString();
|
|
95
106
|
return {
|
|
96
107
|
psm,
|
|
97
|
-
migrate
|
|
108
|
+
migrate,
|
|
109
|
+
pulled: false,
|
|
110
|
+
label: "",
|
|
111
|
+
message: [],
|
|
112
|
+
date: null,
|
|
98
113
|
};
|
|
99
114
|
});
|
|
100
115
|
if (!revs.length) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
return {
|
|
117
|
+
error: new Error(`No migrate commited! Use ${chalk_1.default.bold("psm migrate commit")} first!`),
|
|
118
|
+
revs: revs,
|
|
119
|
+
};
|
|
104
120
|
}
|
|
105
|
-
const
|
|
121
|
+
const missedPreviews = revs.filter((n, i) => {
|
|
106
122
|
return (!!n.psm.migration.preview && !revs.find(p => p.psm.migration.revision === n.psm.migration.preview))
|
|
107
123
|
|| (i > 0 && !n.psm.migration.preview);
|
|
108
124
|
});
|
|
109
|
-
if (!!
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
125
|
+
if (!!missedPreviews.length) {
|
|
126
|
+
const missed = missedPreviews.map(n => `${n.psm.psm.migration} - ${n.psm.migration.label} at ${n.psm.migration.instate}`);
|
|
127
|
+
return {
|
|
128
|
+
revs: revs,
|
|
129
|
+
error: new Error(`MISSING PREVIEW migration for...\n ${missed.join(", ")}`),
|
|
130
|
+
};
|
|
113
131
|
}
|
|
114
|
-
let migrated = yield driver.migrated({
|
|
115
|
-
url: process.env[psm.psm.url],
|
|
116
|
-
sys: psm.psm.sys
|
|
132
|
+
let migrated = yield opts.driver.migrated({
|
|
133
|
+
url: process.env[opts.psm.psm.url],
|
|
134
|
+
sys: opts.psm.psm.sys
|
|
117
135
|
});
|
|
118
136
|
if (!migrated.success) {
|
|
119
137
|
console.error(migrated.error);
|
|
120
138
|
migrated.messages.forEach(error => {
|
|
121
139
|
console.error(error);
|
|
122
140
|
});
|
|
123
|
-
return
|
|
141
|
+
return {
|
|
142
|
+
error: new Error("Load Migrated failed!"),
|
|
143
|
+
hint: migrated.error,
|
|
144
|
+
revs: revs
|
|
145
|
+
};
|
|
124
146
|
}
|
|
125
147
|
for (let i = 0; i < revs.length; i++) {
|
|
126
148
|
let next = revs[i];
|
|
127
149
|
let pl = !!((_a = next.psm.migration.label) === null || _a === void 0 ? void 0 : _a.length) ? ` - ${next.psm.migration.label} ` : " ";
|
|
128
150
|
let label = `RevNo ${chalk_1.default.bold(next.psm.migration.revision)}${pl}commited at ${next.psm.migration.instate}`;
|
|
129
151
|
const mig = migrated.migrated.find(value => value.sid === next.psm.psm.migration);
|
|
152
|
+
next.label = label;
|
|
153
|
+
next.date = mig.date;
|
|
130
154
|
if (!!mig) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
const migrator = driver.migrator({
|
|
135
|
-
url: process.env[next.psm.psm.url],
|
|
136
|
-
migrate: next.migrate,
|
|
137
|
-
check: "",
|
|
138
|
-
core: "",
|
|
139
|
-
});
|
|
140
|
-
const result = yield migrator.migrate();
|
|
141
|
-
if (!result.success) {
|
|
142
|
-
console.error(result.error);
|
|
143
|
-
result.messages.forEach(error => {
|
|
144
|
-
console.error(error);
|
|
145
|
-
});
|
|
146
|
-
console.error("Migrate error: Push migration failed!");
|
|
147
|
-
console.log(`${label} is migrated at ${mig.date} - ${chalk_1.default.redBright.bold("FAILED")}`);
|
|
148
|
-
return;
|
|
155
|
+
next.message.push(`${label} is migrated at ${mig.date}`);
|
|
156
|
+
next.pulled = true;
|
|
149
157
|
}
|
|
150
|
-
console.log(`${label} is migrated at ${mig.date} - ${chalk_1.default.greenBright.bold("SUCCESS")}`);
|
|
151
158
|
}
|
|
159
|
+
return {
|
|
160
|
+
revs
|
|
161
|
+
};
|
|
152
162
|
});
|
|
153
163
|
}
|
|
154
164
|
//# sourceMappingURL=deploy.js.map
|
package/src/tools/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["deploy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["deploy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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CAAC;CAAA"}
|
package/src/tools/deploy.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as Path from "node:path";
|
|
|
4
4
|
import {PSMConfigFile} from "../configs";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import {PSMDriver} from "../driver";
|
|
7
|
+
import {psmLockup} from "./common";
|
|
7
8
|
|
|
8
9
|
export interface DeployOptions {
|
|
9
10
|
schema?:string
|
|
@@ -11,41 +12,14 @@ export interface DeployOptions {
|
|
|
11
12
|
label?:string
|
|
12
13
|
"generate-command":string
|
|
13
14
|
}
|
|
14
|
-
const prisma = [
|
|
15
|
-
`${process.cwd()}/schema.prisma`,
|
|
16
|
-
`${process.cwd()}/prisma/schema.prisma`,
|
|
17
|
-
];
|
|
18
15
|
|
|
19
16
|
const TAG = "PSM DEPLOY >"
|
|
20
17
|
|
|
21
18
|
export async function deploy( opts: DeployOptions) {
|
|
22
|
-
console.log("Sdsd sd sdsdsds")
|
|
23
19
|
require('dotenv').config();
|
|
24
|
-
let schema = opts.schema;
|
|
25
|
-
if( !schema ) {
|
|
26
|
-
schema = prisma.find( value => {
|
|
27
|
-
return fs.existsSync( value );
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
if( !schema ) {
|
|
31
|
-
return console.error( "Migrate error: schema.prisma file not found!" );
|
|
32
|
-
}
|
|
33
|
-
console.log(`PSM deploy base do schema ${schema}`);
|
|
34
20
|
|
|
35
|
-
const home =
|
|
36
|
-
const psm_yml = Path.join( home, "psm.yml" );
|
|
37
|
-
const psm_sql = Path.join( home, "psm.sql");
|
|
38
|
-
if( !fs.existsSync( psm_yml ) ) {
|
|
39
|
-
return console.error( "Migrate error: psm.yml file not found!" );
|
|
40
|
-
}
|
|
41
|
-
if( !fs.existsSync( psm_sql ) ) {
|
|
42
|
-
return console.error( "Migrate error: psm.sql file not found!" );
|
|
43
|
-
}
|
|
21
|
+
const { psm, psm_sql, driver, home} = await psmLockup({ schema: opts.schema });
|
|
44
22
|
|
|
45
|
-
|
|
46
|
-
console.log(`PSM migrate using ${psm_yml}`);
|
|
47
|
-
const psm = yaml.parse( fs.readFileSync( psm_yml ).toString() ) as PSMConfigFile;
|
|
48
|
-
const driver = await import( psm.psm.driver ) as PSMDriver;
|
|
49
23
|
let migrator = driver.migrator({
|
|
50
24
|
url: process.env[psm.psm.url],
|
|
51
25
|
migrate: "",
|
|
@@ -59,11 +33,54 @@ export async function deploy( opts: DeployOptions) {
|
|
|
59
33
|
result.messages.forEach( error => {
|
|
60
34
|
console.error( error );
|
|
61
35
|
});
|
|
62
|
-
|
|
36
|
+
throw new Error( "Migrate error: Core failed!" );
|
|
63
37
|
}
|
|
64
38
|
|
|
39
|
+
const pullResponse = await fetch({
|
|
40
|
+
home: home,
|
|
41
|
+
driver: driver,
|
|
42
|
+
psm: psm
|
|
43
|
+
});
|
|
65
44
|
|
|
66
|
-
|
|
45
|
+
if( pullResponse.error ){
|
|
46
|
+
throw pullResponse.error;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const revs = pullResponse.revs;
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i < revs.length; i++) {
|
|
52
|
+
let next = revs[i];
|
|
53
|
+
next.message.forEach( console.log );
|
|
54
|
+
if( next.pulled ) return;
|
|
55
|
+
|
|
56
|
+
const migrator = driver.migrator({
|
|
57
|
+
url: process.env[next.psm.psm.url],
|
|
58
|
+
migrate: next.migrate,
|
|
59
|
+
check: "",
|
|
60
|
+
core: "",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const result = await migrator.migrate();
|
|
64
|
+
|
|
65
|
+
if( !result.success ) {
|
|
66
|
+
console.error( result.error );
|
|
67
|
+
result.messages.forEach( error => {
|
|
68
|
+
console.error( error );
|
|
69
|
+
});
|
|
70
|
+
console.error( `${next.label} is migrated at ${next.date} - ${chalk.redBright.bold( "FAILED")}` );
|
|
71
|
+
throw new Error( "Migrate error: Push migration failed!" );
|
|
72
|
+
}
|
|
73
|
+
console.log( `${next.label} is migrated at ${next.date} - ${chalk.greenBright.bold( "SUCCESS")}` );
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface FetchOptions {
|
|
78
|
+
home:string,
|
|
79
|
+
driver:PSMDriver,
|
|
80
|
+
psm:PSMConfigFile
|
|
81
|
+
}
|
|
82
|
+
export async function fetch(opts:FetchOptions){
|
|
83
|
+
const revisions = Path.join( opts.home, `psm/revisions/definition`);
|
|
67
84
|
let revs = fs.readdirSync( revisions )
|
|
68
85
|
.filter( n => fs.statSync( Path.join( revisions, n)).isDirectory() )
|
|
69
86
|
.map( n => {
|
|
@@ -72,31 +89,38 @@ export async function deploy( opts: DeployOptions) {
|
|
|
72
89
|
let migrate = fs.readFileSync( Path.join( revisions, n, "migration.sql") ).toString()
|
|
73
90
|
return {
|
|
74
91
|
psm,
|
|
75
|
-
migrate
|
|
92
|
+
migrate,
|
|
93
|
+
pulled:false,
|
|
94
|
+
label:"",
|
|
95
|
+
message:[]as string[],
|
|
96
|
+
date: null as Date,
|
|
76
97
|
}
|
|
77
98
|
});
|
|
78
99
|
|
|
79
100
|
if( !revs.length ){
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
return {
|
|
102
|
+
error: new Error(`No migrate commited! Use ${ chalk.bold("psm migrate commit")} first!`),
|
|
103
|
+
revs: revs,
|
|
104
|
+
};
|
|
83
105
|
}
|
|
84
106
|
|
|
85
|
-
const
|
|
107
|
+
const missedPreviews = revs.filter( (n, i) => {
|
|
86
108
|
return (!!n.psm.migration.preview && !revs.find( p => p.psm.migration.revision === n.psm.migration.preview))
|
|
87
109
|
|| ( i > 0 && !n.psm.migration.preview)
|
|
88
110
|
});
|
|
89
111
|
|
|
90
|
-
if( !!
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
if( !!missedPreviews.length){
|
|
113
|
+
const missed = missedPreviews.map(n=> `${n.psm.psm.migration} - ${n.psm.migration.label} at ${n.psm.migration.instate}` );
|
|
114
|
+
return {
|
|
115
|
+
revs: revs,
|
|
116
|
+
error: new Error(`MISSING PREVIEW migration for...\n ${missed.join(", ")}`),
|
|
117
|
+
};
|
|
94
118
|
}
|
|
95
119
|
|
|
96
120
|
|
|
97
|
-
let migrated = await driver.migrated({
|
|
98
|
-
url: process.env[psm.psm.url],
|
|
99
|
-
sys: psm.psm.sys
|
|
121
|
+
let migrated = await opts.driver.migrated({
|
|
122
|
+
url: process.env[opts.psm.psm.url],
|
|
123
|
+
sys: opts.psm.psm.sys
|
|
100
124
|
});
|
|
101
125
|
|
|
102
126
|
if( !migrated.success ) {
|
|
@@ -104,7 +128,11 @@ export async function deploy( opts: DeployOptions) {
|
|
|
104
128
|
migrated.messages.forEach( error => {
|
|
105
129
|
console.error( error );
|
|
106
130
|
});
|
|
107
|
-
return
|
|
131
|
+
return {
|
|
132
|
+
error: new Error( "Load Migrated failed!" ),
|
|
133
|
+
hint: migrated.error,
|
|
134
|
+
revs: revs
|
|
135
|
+
};
|
|
108
136
|
}
|
|
109
137
|
|
|
110
138
|
for (let i = 0; i < revs.length; i++) {
|
|
@@ -112,30 +140,14 @@ export async function deploy( opts: DeployOptions) {
|
|
|
112
140
|
let pl = !!next.psm.migration.label?.length ? ` - ${next.psm.migration.label} `: " "
|
|
113
141
|
let label = `RevNo ${ chalk.bold(next.psm.migration.revision)}${pl}commited at ${next.psm.migration.instate}`;
|
|
114
142
|
const mig = migrated.migrated.find( value => value.sid === next.psm.psm.migration );
|
|
115
|
-
|
|
143
|
+
next.label = label;
|
|
144
|
+
next.date = mig.date;
|
|
116
145
|
if( !!mig ) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
const migrator = driver.migrator({
|
|
121
|
-
url: process.env[next.psm.psm.url],
|
|
122
|
-
migrate: next.migrate,
|
|
123
|
-
check: "",
|
|
124
|
-
core: "",
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const result = await migrator.migrate();
|
|
128
|
-
|
|
129
|
-
if( !result.success ) {
|
|
130
|
-
console.error( result.error );
|
|
131
|
-
result.messages.forEach( error => {
|
|
132
|
-
console.error( error );
|
|
133
|
-
});
|
|
134
|
-
console.error( "Migrate error: Push migration failed!" );
|
|
135
|
-
console.log( `${label} is migrated at ${mig.date} - ${chalk.redBright.bold( "FAILED")}` );
|
|
136
|
-
return;
|
|
146
|
+
next.message.push(`${label} is migrated at ${mig.date}`);
|
|
147
|
+
next.pulled = true;
|
|
137
148
|
}
|
|
138
|
-
console.log( `${label} is migrated at ${mig.date} - ${chalk.greenBright.bold( "SUCCESS")}` );
|
|
139
|
-
|
|
140
149
|
}
|
|
150
|
+
return {
|
|
151
|
+
revs
|
|
152
|
+
};
|
|
141
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,SAuIvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,4BAuIC;AA9JD,uCAAwB;AACxB,gDAAkC;AAClC,2CAA6B;AAC7B,+DAA+F;AAC/F,8CAAiD;AACjD,mCAA4C;AAU5C,kCAAoC;AAGpC,SAAS,KAAK,CAAE,GAAU,EAAE,OAAc,EAAE,IAAW;IACnD,EAAE,CAAC,aAAa,CAAE,IAAI,CAAC,IAAI,CAAE,OAAO,EAAE,IAAI,CAAE,EAAE,GAAG,CAAE,CAAC;AACxD,CAAC;AAGD,SAAgB,QAAQ;IACpB,IA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