u
This commit is contained in:
@@ -138,8 +138,11 @@ export function makeVersionContext(file, getVersion, setVersion) {
|
||||
* @returns {Promise<number>} Number of steps applied.
|
||||
*/
|
||||
export async function migrateSchema({ direction, dirUrl, current, target, runStep, log = console.log }) {
|
||||
if (direction === 'upgrade' && target < current) {
|
||||
throw new Error(`Database schema version ${current} is newer than this application supports (${target})`);
|
||||
if (direction === 'upgrade' && current > target) {
|
||||
throw new Error(
|
||||
`Refusing to start: database schema version (${current}) is higher than the highest version in the upgrade folder (${target}). ` +
|
||||
`The database was updated by a newer version of the application. Please update the application code or downgrade the database schema.`
|
||||
);
|
||||
}
|
||||
if (direction === 'downgrade' && target > current) {
|
||||
throw new Error(`Cannot downgrade schema from version ${current} to higher version ${target}`);
|
||||
|
||||
Reference in New Issue
Block a user