@famgia/omnify-atlas 2.0.14 → 2.0.16
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/dist/index.cjs +15 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +15 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -538,7 +538,8 @@ function addEnhancedMigrationRecord(lockFile, options) {
|
|
|
538
538
|
type: options.type,
|
|
539
539
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
540
540
|
schemas: options.schemas,
|
|
541
|
-
checksum: computeHash(options.content)
|
|
541
|
+
checksum: computeHash(options.content),
|
|
542
|
+
...options.outputPath && { outputPath: options.outputPath }
|
|
542
543
|
};
|
|
543
544
|
return {
|
|
544
545
|
...lockFile,
|
|
@@ -559,28 +560,32 @@ function extractTableNameFromFilename(fileName) {
|
|
|
559
560
|
if (dropMatch) return dropMatch[1];
|
|
560
561
|
return null;
|
|
561
562
|
}
|
|
562
|
-
async function validateMigrations(lockFile, migrationsDir) {
|
|
563
|
+
async function validateMigrations(lockFile, migrationsDir, rootDir) {
|
|
563
564
|
const missingFiles = [];
|
|
564
565
|
const modifiedFiles = [];
|
|
565
566
|
const staleFiles = [];
|
|
567
|
+
const { existsSync: existsSync2, readdirSync, readFileSync } = await import("fs");
|
|
568
|
+
const { join: join4, resolve: resolve2, dirname } = await import("path");
|
|
569
|
+
const resolvedRootDir = rootDir ?? dirname(dirname(migrationsDir));
|
|
566
570
|
let filesOnDisk = [];
|
|
567
571
|
try {
|
|
568
|
-
const { readdirSync } = await import("fs");
|
|
569
572
|
filesOnDisk = readdirSync(migrationsDir).filter((f) => f.endsWith(".php"));
|
|
570
573
|
} catch {
|
|
571
574
|
}
|
|
572
|
-
const filesOnDiskSet = new Set(filesOnDisk);
|
|
573
575
|
for (const migration of lockFile.migrations) {
|
|
574
576
|
const fileName = migration.fileName;
|
|
575
|
-
|
|
577
|
+
let checkDir = migrationsDir;
|
|
578
|
+
if (migration.outputPath) {
|
|
579
|
+
checkDir = resolve2(resolvedRootDir, migration.outputPath);
|
|
580
|
+
}
|
|
581
|
+
const filePath = join4(checkDir, fileName);
|
|
582
|
+
if (!existsSync2(filePath)) {
|
|
576
583
|
missingFiles.push(fileName);
|
|
577
584
|
continue;
|
|
578
585
|
}
|
|
579
586
|
if (migration.checksum) {
|
|
580
587
|
try {
|
|
581
|
-
const
|
|
582
|
-
const { join: join4 } = await import("path");
|
|
583
|
-
const content = readFileSync(join4(migrationsDir, fileName), "utf8");
|
|
588
|
+
const content = readFileSync(filePath, "utf8");
|
|
584
589
|
const currentChecksum = computeHash(content);
|
|
585
590
|
if (currentChecksum !== migration.checksum) {
|
|
586
591
|
modifiedFiles.push(fileName);
|
|
@@ -644,7 +649,8 @@ function getMigrationsToRegenerate(lockFile, missingFiles) {
|
|
|
644
649
|
timestamp,
|
|
645
650
|
tableName,
|
|
646
651
|
type,
|
|
647
|
-
schemas: migration.schemas
|
|
652
|
+
schemas: migration.schemas,
|
|
653
|
+
outputPath: mig.outputPath
|
|
648
654
|
});
|
|
649
655
|
}
|
|
650
656
|
return result;
|