@famgia/omnify-cli 2.0.42 → 2.0.44
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/cli.js +48 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +48 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -2032,7 +2032,54 @@ async function runGenerate(options) {
|
|
|
2032
2032
|
const existingLock = await (0, import_omnify_atlas2.readLockFile)(lockPath);
|
|
2033
2033
|
const currentSnapshots = await (0, import_omnify_atlas2.buildSchemaSnapshots)(schemas);
|
|
2034
2034
|
const v2Lock = existingLock && (0, import_omnify_atlas2.isLockFileV2)(existingLock) ? existingLock : null;
|
|
2035
|
-
|
|
2035
|
+
let comparison = (0, import_omnify_atlas2.compareSchemasDeep)(currentSnapshots, v2Lock);
|
|
2036
|
+
if (existingLock && !(0, import_omnify_atlas2.isLockFileV2)(existingLock) && existingLock.schemas) {
|
|
2037
|
+
logger.debug("Detected v1 lock file format - performing hash-based comparison");
|
|
2038
|
+
const v1Schemas = existingLock.schemas;
|
|
2039
|
+
const modifiedInV1 = /* @__PURE__ */ new Set();
|
|
2040
|
+
for (const [name, v1Schema] of Object.entries(v1Schemas)) {
|
|
2041
|
+
const currentSnapshot = currentSnapshots[name];
|
|
2042
|
+
if (currentSnapshot && v1Schema.hash !== currentSnapshot.hash) {
|
|
2043
|
+
modifiedInV1.add(name);
|
|
2044
|
+
logger.debug(` Schema ${name}: hash changed (v1 migration)`);
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
if (modifiedInV1.size > 0) {
|
|
2048
|
+
const updatedChanges = [];
|
|
2049
|
+
for (const change of comparison.changes) {
|
|
2050
|
+
if (change.changeType === "added" && modifiedInV1.has(change.schemaName)) {
|
|
2051
|
+
const currentSnapshot = currentSnapshots[change.schemaName];
|
|
2052
|
+
if (currentSnapshot) {
|
|
2053
|
+
const columnChanges = [];
|
|
2054
|
+
for (const [propName, propDef] of Object.entries(currentSnapshot.properties)) {
|
|
2055
|
+
columnChanges.push({
|
|
2056
|
+
column: propName,
|
|
2057
|
+
changeType: "added",
|
|
2058
|
+
currentDef: propDef
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
updatedChanges.push({
|
|
2062
|
+
schemaName: change.schemaName,
|
|
2063
|
+
changeType: "modified",
|
|
2064
|
+
previousHash: v1Schemas[change.schemaName]?.hash,
|
|
2065
|
+
currentHash: currentSnapshot.hash,
|
|
2066
|
+
columnChanges: columnChanges.length > 0 ? columnChanges : void 0
|
|
2067
|
+
});
|
|
2068
|
+
logger.info(` \u2022 ${change.schemaName}: upgrading from v1 lock file (will generate ALTER migration)`);
|
|
2069
|
+
} else {
|
|
2070
|
+
updatedChanges.push(change);
|
|
2071
|
+
}
|
|
2072
|
+
} else {
|
|
2073
|
+
updatedChanges.push(change);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
comparison = {
|
|
2077
|
+
hasChanges: updatedChanges.length > 0 || comparison.unchanged.length !== Object.keys(currentSnapshots).length,
|
|
2078
|
+
changes: updatedChanges,
|
|
2079
|
+
unchanged: comparison.unchanged
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2036
2083
|
const chainFilePath = (0, import_node_path9.resolve)(rootDir, import_omnify_atlas2.VERSION_CHAIN_FILE);
|
|
2037
2084
|
const versionChain = await (0, import_omnify_atlas2.readVersionChain)(chainFilePath);
|
|
2038
2085
|
if (versionChain && comparison.hasChanges) {
|