Use single file upgrades where possible.
This commit is contained in:
Родитель
49ac9796a1
Коммит
8eaeefb9ea
|
@ -406,6 +406,11 @@ export interface CompileUpgradeParams {
|
|||
* A directory to store parts of the compiled upgrade
|
||||
*/
|
||||
upgradeTempDir: string;
|
||||
/**
|
||||
* Enable single file upgrades, set to true to allow
|
||||
* using single file upgrades.
|
||||
*/
|
||||
singleFileUpgrades?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -492,10 +497,42 @@ export interface UpgradeDescription {
|
|||
newSha: string;
|
||||
}
|
||||
|
||||
|
||||
export type CompiledUpgrades = MultiFileCompiledUpgrades | SingleFileCompiledUpgrade
|
||||
|
||||
/**
|
||||
* A compiled upgrade.
|
||||
* The upgrade is spread among multiple files.
|
||||
*/
|
||||
export interface CompiledUpgrades {
|
||||
export interface MultiFileCompiledUpgrades {
|
||||
/**
|
||||
* The initial sha of the dbscheme to upgrade from
|
||||
*/
|
||||
initialSha: string;
|
||||
/**
|
||||
* The path to the new dataset statistics
|
||||
*/
|
||||
newStatsPath: string;
|
||||
/**
|
||||
* The path to the new dataset dbscheme
|
||||
*/
|
||||
newDbscheme: string;
|
||||
/**
|
||||
* The steps in the upgrade path
|
||||
*/
|
||||
scripts: CompiledUpgradeScript[];
|
||||
/**
|
||||
* Will never exist in an old result
|
||||
*/
|
||||
compiledUpgradeFile?: never;
|
||||
/**
|
||||
* The sha of the target dataset.
|
||||
*/
|
||||
targetSha: string;
|
||||
}
|
||||
|
||||
|
||||
export interface SingleFileCompiledUpgrade {
|
||||
/**
|
||||
* The initial sha of the dbscheme to upgrade from
|
||||
*/
|
||||
|
@ -507,7 +544,11 @@ export interface CompiledUpgrades {
|
|||
/**
|
||||
* The steps in the upgrade path
|
||||
*/
|
||||
scripts: CompiledUpgradeScript[];
|
||||
descriptions: UpgradeDescription[];
|
||||
/**
|
||||
* The file containing the upgrade
|
||||
*/
|
||||
compiledUpgradeFile: string;
|
||||
/**
|
||||
* The sha of the target dataset.
|
||||
*/
|
||||
|
|
|
@ -157,7 +157,11 @@ export async function upgradeDatabase(
|
|||
|
||||
try {
|
||||
qs.logger.log('Running the following database upgrade:');
|
||||
qs.logger.log(compileUpgradeResult.compiledUpgrades.scripts.map(s => s.description.description).join('\n'));
|
||||
if (compileUpgradeResult.compiledUpgrades.compiledUpgradeFile === undefined) {
|
||||
qs.logger.log(compileUpgradeResult.compiledUpgrades.scripts.map(s => s.description.description).join('\n'));
|
||||
} else {
|
||||
qs.logger.log(compileUpgradeResult.compiledUpgrades.descriptions.map(s => s.description).join('\n'));
|
||||
}
|
||||
return await runDatabaseUpgrade(qs, db, compileUpgradeResult.compiledUpgrades, progress, token);
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -192,7 +196,8 @@ async function compileDatabaseUpgrade(
|
|||
): Promise<messages.CompileUpgradeResult> {
|
||||
const params: messages.CompileUpgradeParams = {
|
||||
upgrade: upgradeParams,
|
||||
upgradeTempDir: upgradesTmpDir.name
|
||||
upgradeTempDir: upgradesTmpDir.name,
|
||||
singleFileUpgrades: true
|
||||
};
|
||||
|
||||
progress({
|
||||
|
|
Загрузка…
Ссылка в новой задаче