@supacloud/cli 0.12.3 → 0.12.4
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.js +13 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6525,22 +6525,26 @@ function migrationRows(data) {
|
|
|
6525
6525
|
const rows = Array.isArray(data) ? data : data?.rows || [];
|
|
6526
6526
|
return Array.isArray(rows) ? rows.filter((row) => Boolean(row && typeof row === "object")) : [];
|
|
6527
6527
|
}
|
|
6528
|
-
function
|
|
6528
|
+
function migrationIdentityKey(version, name) {
|
|
6529
6529
|
return `${version}\x00${name}`;
|
|
6530
6530
|
}
|
|
6531
|
-
function
|
|
6531
|
+
function nameBoundMigrationMarkerKeys(data) {
|
|
6532
6532
|
const keys = new Set;
|
|
6533
6533
|
for (const row of migrationRows(data)) {
|
|
6534
6534
|
if (row.version == null || row.name == null || !Array.isArray(row.statements))
|
|
6535
6535
|
continue;
|
|
6536
|
-
if (row.statements.length !== 1
|
|
6536
|
+
if (row.statements.length !== 1)
|
|
6537
6537
|
continue;
|
|
6538
|
-
|
|
6538
|
+
const name = String(row.name);
|
|
6539
|
+
const marker = row.statements[0];
|
|
6540
|
+
if (marker !== `baseline:${name}` && marker !== `direct-apply:${name}`)
|
|
6541
|
+
continue;
|
|
6542
|
+
keys.add(migrationIdentityKey(String(row.version), String(row.name)));
|
|
6539
6543
|
}
|
|
6540
6544
|
return keys;
|
|
6541
6545
|
}
|
|
6542
6546
|
function historicalChecksumMarkerKeys(data, migrationFiles) {
|
|
6543
|
-
const filesByKey = new Map(migrationFiles.map((migration) => [
|
|
6547
|
+
const filesByKey = new Map(migrationFiles.map((migration) => [migrationIdentityKey(migration.version, migration.name), migration]));
|
|
6544
6548
|
const keys = new Set;
|
|
6545
6549
|
for (const row of migrationRows(data)) {
|
|
6546
6550
|
if (row.version == null || row.name == null || !Array.isArray(row.statements) || row.statements.length !== 1)
|
|
@@ -6548,7 +6552,7 @@ function historicalChecksumMarkerKeys(data, migrationFiles) {
|
|
|
6548
6552
|
const marker = row.statements[0];
|
|
6549
6553
|
if (typeof marker !== "string" || !/^sha256:[0-9a-f]{64}$/.test(marker))
|
|
6550
6554
|
continue;
|
|
6551
|
-
const key =
|
|
6555
|
+
const key = migrationIdentityKey(String(row.version), String(row.name));
|
|
6552
6556
|
const migration = filesByKey.get(key);
|
|
6553
6557
|
if (!migration)
|
|
6554
6558
|
continue;
|
|
@@ -6809,11 +6813,11 @@ Actions: ${allActions.join(", ")}${readOnly ? " (read-only mode)" : ""}`, {
|
|
|
6809
6813
|
}
|
|
6810
6814
|
const applied = [];
|
|
6811
6815
|
const skipped = [];
|
|
6812
|
-
const
|
|
6816
|
+
const nameBoundMarkerKeys = nameBoundMigrationMarkerKeys(migrationsResult.data);
|
|
6813
6817
|
const historicalChecksumKeys = historicalChecksumMarkerKeys(migrationsResult.data, migrationFiles);
|
|
6814
6818
|
for (const { file, name, version, sql } of migrationFiles) {
|
|
6815
|
-
const migrationKey =
|
|
6816
|
-
if (
|
|
6819
|
+
const migrationKey = migrationIdentityKey(version, name);
|
|
6820
|
+
if (nameBoundMarkerKeys.has(migrationKey) || historicalChecksumKeys.has(migrationKey)) {
|
|
6817
6821
|
skipped.push(file);
|
|
6818
6822
|
continue;
|
|
6819
6823
|
}
|