@dbcube/schema-builder 5.1.6 → 5.1.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/bun.lockb +0 -0
- package/dist/index.cjs +28 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/bun.lockb
CHANGED
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -30,8 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
Config: () => import_core2.Config,
|
|
33
34
|
CubeValidator: () => CubeValidator,
|
|
34
35
|
DependencyResolver: () => DependencyResolver,
|
|
36
|
+
Engine: () => import_core2.Engine,
|
|
35
37
|
Schema: () => Schema,
|
|
36
38
|
UIUtils: () => UIUtils,
|
|
37
39
|
default: () => index_default
|
|
@@ -1433,13 +1435,18 @@ var Schema = class {
|
|
|
1433
1435
|
UIUtils.showOperationSummary(summary);
|
|
1434
1436
|
return totalSeedersProcessed > 0 ? { processed: totalSeedersProcessed, success: successCount, errors: errorCount } : null;
|
|
1435
1437
|
}
|
|
1436
|
-
async executeAlters() {
|
|
1438
|
+
async executeAlters(filterFiles, options = {}) {
|
|
1437
1439
|
const startTime = Date.now();
|
|
1438
1440
|
const cubesDir = import_path3.default.join(process.cwd(), "dbcube");
|
|
1441
|
+
const dryRun = options.dryRun === true;
|
|
1439
1442
|
if (!import_fs4.default.existsSync(cubesDir)) {
|
|
1440
1443
|
throw new Error("\u274C The cubes folder does not exist");
|
|
1441
1444
|
}
|
|
1442
|
-
|
|
1445
|
+
let cubeFiles = FileUtils_default.getCubeFilesRecursively("dbcube", ".alter.cube");
|
|
1446
|
+
if (filterFiles && filterFiles.length > 0) {
|
|
1447
|
+
const wanted = new Set(filterFiles.map((f) => import_path3.default.basename(f)));
|
|
1448
|
+
cubeFiles = cubeFiles.filter((f) => wanted.has(import_path3.default.basename(f)));
|
|
1449
|
+
}
|
|
1443
1450
|
if (cubeFiles.length === 0) {
|
|
1444
1451
|
throw new Error("\u274C There are no .alter.cube files to execute");
|
|
1445
1452
|
}
|
|
@@ -1494,6 +1501,22 @@ var Schema = class {
|
|
|
1494
1501
|
}
|
|
1495
1502
|
delete queries.data.database_type;
|
|
1496
1503
|
const parseJsonQueries = JSON.stringify(queries.data);
|
|
1504
|
+
if (dryRun) {
|
|
1505
|
+
console.log(`
|
|
1506
|
+
${import_chalk2.default.cyan("\u2500\u2500 dry-run \u2500\u2500")} ${import_chalk2.default.bold(alterName)}`);
|
|
1507
|
+
const allQueries = [
|
|
1508
|
+
...queries.data.regular_queries ?? [],
|
|
1509
|
+
...queries.data.special_queries ?? []
|
|
1510
|
+
];
|
|
1511
|
+
for (const q of allQueries) {
|
|
1512
|
+
console.log(` ${import_chalk2.default.gray("SQL>")} ${q}`);
|
|
1513
|
+
}
|
|
1514
|
+
UIUtils.showItemSuccess(alterName + " (dry-run)");
|
|
1515
|
+
successCount++;
|
|
1516
|
+
processedAlters.push(alterName);
|
|
1517
|
+
totalAltersProcessed++;
|
|
1518
|
+
continue;
|
|
1519
|
+
}
|
|
1497
1520
|
const response = await this.engine.run("schema_engine", [
|
|
1498
1521
|
"--action",
|
|
1499
1522
|
"execute",
|
|
@@ -1652,11 +1675,14 @@ ${import_chalk2.default.red("\u{1F6AB}")} ${import_chalk2.default.bold.red("ERRO
|
|
|
1652
1675
|
}
|
|
1653
1676
|
|
|
1654
1677
|
// src/index.ts
|
|
1678
|
+
var import_core2 = require("@dbcube/core");
|
|
1655
1679
|
var index_default = Schema;
|
|
1656
1680
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1657
1681
|
0 && (module.exports = {
|
|
1682
|
+
Config,
|
|
1658
1683
|
CubeValidator,
|
|
1659
1684
|
DependencyResolver,
|
|
1685
|
+
Engine,
|
|
1660
1686
|
Schema,
|
|
1661
1687
|
UIUtils
|
|
1662
1688
|
});
|