mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-05 23:28:44 +00:00
Dont run migration again when rc
This commit is contained in:
@@ -128,7 +128,7 @@ async function executeScripts() {
|
|||||||
console.log(`Starting migrations from version ${startVersion}`);
|
console.log(`Starting migrations from version ${startVersion}`);
|
||||||
|
|
||||||
const migrationsToRun = migrations.filter((migration) =>
|
const migrationsToRun = migrations.filter((migration) =>
|
||||||
semver.gt(migration.version, startVersion)
|
shouldRunMigration(migration.version, startVersion)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
@@ -179,3 +179,23 @@ async function executeScripts() {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shouldRunMigration(migrationVersion: string, currentVersion: string) {
|
||||||
|
const migration = semver.parse(migrationVersion);
|
||||||
|
const current = semver.parse(currentVersion);
|
||||||
|
|
||||||
|
// Treat x.y.z-rc.* as equivalent to x.y.z so restarts on RC builds do not re-run the same migration.
|
||||||
|
if (
|
||||||
|
migration &&
|
||||||
|
current &&
|
||||||
|
migration.prerelease.length === 0 &&
|
||||||
|
current.prerelease[0] === "rc" &&
|
||||||
|
migration.major === current.major &&
|
||||||
|
migration.minor === current.minor &&
|
||||||
|
migration.patch === current.patch
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return semver.gt(migrationVersion, currentVersion);
|
||||||
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ async function executeScripts() {
|
|||||||
console.log(`Starting migrations from version ${startVersion}`);
|
console.log(`Starting migrations from version ${startVersion}`);
|
||||||
|
|
||||||
const migrationsToRun = migrations.filter((migration) =>
|
const migrationsToRun = migrations.filter((migration) =>
|
||||||
semver.gt(migration.version, startVersion)
|
shouldRunMigration(migration.version, startVersion)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
@@ -223,3 +223,23 @@ async function executeScripts() {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shouldRunMigration(migrationVersion: string, currentVersion: string) {
|
||||||
|
const migration = semver.parse(migrationVersion);
|
||||||
|
const current = semver.parse(currentVersion);
|
||||||
|
|
||||||
|
// Treat x.y.z-rc.* as equivalent to x.y.z so restarts on RC builds do not re-run the same migration.
|
||||||
|
if (
|
||||||
|
migration &&
|
||||||
|
current &&
|
||||||
|
migration.prerelease.length === 0 &&
|
||||||
|
current.prerelease[0] === "rc" &&
|
||||||
|
migration.major === current.major &&
|
||||||
|
migration.minor === current.minor &&
|
||||||
|
migration.patch === current.patch
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return semver.gt(migrationVersion, currentVersion);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user