@dbcube/schema-builder 5.1.4 → 5.1.5
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 +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class Schema {
|
|
|
27
27
|
createDatabase(): Promise<any>;
|
|
28
28
|
refreshTables(): Promise<any>;
|
|
29
29
|
freshTables(): Promise<any>;
|
|
30
|
-
executeSeeders(): Promise<any>;
|
|
30
|
+
executeSeeders(filterName?: string): Promise<any>;
|
|
31
31
|
executeAlters(): Promise<any>;
|
|
32
32
|
executeTriggers(): Promise<any>;
|
|
33
33
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class Schema {
|
|
|
27
27
|
createDatabase(): Promise<any>;
|
|
28
28
|
refreshTables(): Promise<any>;
|
|
29
29
|
freshTables(): Promise<any>;
|
|
30
|
-
executeSeeders(): Promise<any>;
|
|
30
|
+
executeSeeders(filterName?: string): Promise<any>;
|
|
31
31
|
executeAlters(): Promise<any>;
|
|
32
32
|
executeTriggers(): Promise<any>;
|
|
33
33
|
}
|
package/dist/index.js
CHANGED
|
@@ -252,7 +252,7 @@ ${chalk.red("\u{1F6AB}")} ${chalk.bold.red("ERRORS FOUND")}`);
|
|
|
252
252
|
import fs3 from "fs";
|
|
253
253
|
import path2 from "path";
|
|
254
254
|
var CubeValidator = class {
|
|
255
|
-
validTypes = ["varchar", "int", "string", "text", "boolean", "date", "datetime", "timestamp", "decimal", "float", "double", "enum", "json"];
|
|
255
|
+
validTypes = ["varchar", "int", "tinyint", "bigint", "string", "text", "boolean", "date", "datetime", "timestamp", "decimal", "float", "double", "enum", "json"];
|
|
256
256
|
validOptions = ["not null", "primary", "autoincrement", "unique", "zerofill", "index", "required", "unsigned"];
|
|
257
257
|
validProperties = ["type", "length", "options", "value", "defaultValue", "foreign", "enumValues", "description"];
|
|
258
258
|
knownAnnotations = ["database", "table", "meta", "columns", "indexes", "fields", "dataset", "beforeAdd", "afterAdd", "beforeUpdate", "afterUpdate", "beforeDelete", "afterDelete", "compute", "column", "changeName", "addColumn", "deleteColumn", "renameColumn", "changeType", "changeLength", "changeDefault", "changeOptions", "changeEnumValues"];
|
|
@@ -1309,16 +1309,23 @@ var Schema = class {
|
|
|
1309
1309
|
UIUtils.showOperationSummary(summary);
|
|
1310
1310
|
return totalTablesProcessed > 0 ? { processed: totalTablesProcessed, success: successCount, errors: errorCount } : null;
|
|
1311
1311
|
}
|
|
1312
|
-
async executeSeeders() {
|
|
1312
|
+
async executeSeeders(filterName) {
|
|
1313
1313
|
const startTime = Date.now();
|
|
1314
1314
|
const cubesDir = path4.join(process.cwd(), "dbcube");
|
|
1315
1315
|
if (!fs5.existsSync(cubesDir)) {
|
|
1316
1316
|
throw new Error("\u274C The cubes folder does not exist");
|
|
1317
1317
|
}
|
|
1318
|
-
|
|
1318
|
+
let cubeFiles = FileUtils_default.getCubeFilesRecursively("dbcube", ".seeder.cube");
|
|
1319
1319
|
if (cubeFiles.length === 0) {
|
|
1320
1320
|
throw new Error("\u274C There are no cubes to execute");
|
|
1321
1321
|
}
|
|
1322
|
+
if (filterName) {
|
|
1323
|
+
const normalized = filterName.replace(/\.seeder\.cube$/, "").replace(/\.seeder$/, "");
|
|
1324
|
+
cubeFiles = cubeFiles.filter((file) => path4.basename(file, ".seeder.cube") === normalized);
|
|
1325
|
+
if (cubeFiles.length === 0) {
|
|
1326
|
+
throw new Error(`\u274C Seeder '${filterName}' not found. Make sure the file '${normalized}.seeder.cube' exists in the dbcube folder.`);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1322
1329
|
const orderedCubeFiles = DependencyResolver.orderCubeFiles(cubeFiles, "seeder");
|
|
1323
1330
|
UIUtils.showOperationHeader("EXECUTING SEEDERS", this.name, "\u{1F331}");
|
|
1324
1331
|
let totalSeedersProcessed = 0;
|