@@ -23,11 +23,9 @@ const MAX_UPGRADE_MESSAGE_LINES = 10;
2323 *
2424 * This requires 3 features. The ability to compile an upgrade sequence; The ability to
2525 * run a non-destructive upgrades as a query; the ability to specify a target when
26- * resolving upgrades.
26+ * resolving upgrades. We check for a version of codeql that has all three features.
2727 */
2828export async function hasNondestructiveUpgradeCapabilities ( qs : qsClient . QueryServerClient ) : Promise < boolean > {
29- // TODO change to actual version when known
30- // Note it is probably something 2.4.something
3129 return semver . gte ( await qs . cliServer . getVersion ( ) , '2.4.1' ) ;
3230}
3331
@@ -46,6 +44,9 @@ export async function compileDatabaseUpgradeSequence(qs: qsClient.QueryServerCli
4644 if ( db . contents === undefined || db . contents . dbSchemeUri === undefined ) {
4745 throw new Error ( 'Database is invalid, and cannot be upgraded.' ) ;
4846 }
47+ if ( ! hasNondestructiveUpgradeCapabilities ( qs ) ) {
48+ throw new Error ( 'The version of codeql is to old to run non-destructive upgrades.' ) ;
49+ }
4950 // If possible just compile the upgrade sequence
5051 return await qs . sendRequest ( messages . compileUpgradeSequence , {
5152 upgradeTempDir : currentUpgradeTmp . name ,
@@ -72,7 +73,7 @@ async function compileDatabaseUpgrade(
7273 }
7374 // We have the upgrades we want but compileUpgrade
7475 // requires searching for them. So we use the parent directories of the upgrades
75- // as the uograde path.
76+ // as the upgrade path.
7677 const parentDirs = resolvedSequence . map ( dir => path . dirname ( dir ) ) ;
7778 const uniqueParentDirs = new Set ( parentDirs ) ;
7879 progress ( {
0 commit comments