@supacloud/cli 0.21.1 → 0.21.2
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 +14 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7068,16 +7068,23 @@ function migrationIdentityKey(version, name) {
|
|
|
7068
7068
|
return `${version}\x00${name}`;
|
|
7069
7069
|
}
|
|
7070
7070
|
function migrationIdentities(data) {
|
|
7071
|
-
return migrationRows(data).flatMap((row) => row.version == null || row.name == null ? [] : [{ version: String(row.version), name: String(row.name) }]);
|
|
7071
|
+
return migrationRows(data).flatMap((row) => row.version == null || row.name == null ? [] : [{ version: String(row.version), name: String(row.name), statements: row.statements }]);
|
|
7072
7072
|
}
|
|
7073
|
-
function
|
|
7073
|
+
function isLegacyNameBoundMigration(local, remote, remoteMigrations) {
|
|
7074
|
+
return remoteMigrations.filter((candidate) => candidate.name === local.name).length === 1 && local.name === remote.name && local.version !== remote.version && Array.isArray(remote.statements) && remote.statements.length === 1 && typeof remote.statements[0] === "string" && remote.statements[0].trim() === local.sql.trim();
|
|
7075
|
+
}
|
|
7076
|
+
function identityConflicts(local, remote, remoteMigrations) {
|
|
7074
7077
|
const reusesVersionOrName = local.version === remote.version || local.name === remote.name;
|
|
7075
7078
|
const exactlyMatches = local.version === remote.version && local.name === remote.name;
|
|
7076
|
-
return reusesVersionOrName && !exactlyMatches;
|
|
7079
|
+
return reusesVersionOrName && !exactlyMatches && !isLegacyNameBoundMigration(local, remote, remoteMigrations);
|
|
7077
7080
|
}
|
|
7078
7081
|
function migrationIdentityConflicts(data, migrationFiles) {
|
|
7079
7082
|
const remoteMigrations = migrationIdentities(data);
|
|
7080
|
-
return migrationFiles.flatMap((localMigration) => remoteMigrations.filter((remoteMigration) => identityConflicts(localMigration, remoteMigration)).map((remoteMigration) => ({ file: localMigration.file, local: localMigration, remote: remoteMigration })));
|
|
7083
|
+
return migrationFiles.flatMap((localMigration) => remoteMigrations.filter((remoteMigration) => identityConflicts(localMigration, remoteMigration, remoteMigrations)).map((remoteMigration) => ({ file: localMigration.file, local: localMigration, remote: remoteMigration })));
|
|
7084
|
+
}
|
|
7085
|
+
function legacyNameBoundMigrationKeys(data, migrationFiles) {
|
|
7086
|
+
const remoteMigrations = migrationIdentities(data);
|
|
7087
|
+
return new Set(migrationFiles.flatMap((localMigration) => remoteMigrations.some((remoteMigration) => isLegacyNameBoundMigration(localMigration, remoteMigration, remoteMigrations)) ? [migrationIdentityKey(localMigration.version, localMigration.name)] : []));
|
|
7081
7088
|
}
|
|
7082
7089
|
function assertNoMigrationIdentityConflicts(data, migrationFiles) {
|
|
7083
7090
|
const conflicts = migrationIdentityConflicts(data, migrationFiles);
|
|
@@ -7382,9 +7389,10 @@ Actions: ${allActions.join(", ")}${readOnly ? " (read-only mode)" : ""}`, {
|
|
|
7382
7389
|
const skipped = [];
|
|
7383
7390
|
const nameBoundMarkerKeys = nameBoundMigrationMarkerKeys(migrationsResult.data);
|
|
7384
7391
|
const historicalChecksumKeys = historicalChecksumMarkerKeys(migrationsResult.data, migrationFiles);
|
|
7392
|
+
const legacyNameBoundKeys = legacyNameBoundMigrationKeys(migrationsResult.data, migrationFiles);
|
|
7385
7393
|
for (const { file, name, version, sql } of migrationFiles) {
|
|
7386
7394
|
const migrationKey = migrationIdentityKey(version, name);
|
|
7387
|
-
if (nameBoundMarkerKeys.has(migrationKey) || historicalChecksumKeys.has(migrationKey)) {
|
|
7395
|
+
if (nameBoundMarkerKeys.has(migrationKey) || historicalChecksumKeys.has(migrationKey) || legacyNameBoundKeys.has(migrationKey)) {
|
|
7388
7396
|
skipped.push(file);
|
|
7389
7397
|
continue;
|
|
7390
7398
|
}
|
|
@@ -12039,7 +12047,7 @@ var MUTATION_TOOL_SCHEMA = {
|
|
|
12039
12047
|
// package.json
|
|
12040
12048
|
var package_default = {
|
|
12041
12049
|
name: "@supacloud/cli",
|
|
12042
|
-
version: "0.21.
|
|
12050
|
+
version: "0.21.2",
|
|
12043
12051
|
description: "Project-scoped CLI for SupaCloud users",
|
|
12044
12052
|
type: "module",
|
|
12045
12053
|
main: "./dist/index.js",
|