mirror of
https://github.com/immich-app/immich.git
synced 2025-12-21 09:15:44 +03:00
feat: restore just .sql files
This commit is contained in:
@@ -198,9 +198,14 @@ export async function restoreBackup(
|
|||||||
|
|
||||||
logger.log(`Database Restore Starting. Database Version: ${databaseMajorVersion}`);
|
logger.log(`Database Restore Starting. Database Version: ${databaseMajorVersion}`);
|
||||||
|
|
||||||
|
let inputStream: Readable;
|
||||||
|
if (backupFilePath.endsWith('.gz')) {
|
||||||
const fileStream = storage.createPlainReadStream(backupFilePath);
|
const fileStream = storage.createPlainReadStream(backupFilePath);
|
||||||
const gunzip = storage.createGunzip();
|
const inputStream = storage.createGunzip();
|
||||||
fileStream.pipe(gunzip);
|
fileStream.pipe(inputStream);
|
||||||
|
} else {
|
||||||
|
inputStream = storage.createPlainReadStream(backupFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
async function* sql() {
|
async function* sql() {
|
||||||
yield `
|
yield `
|
||||||
@@ -219,7 +224,7 @@ export async function restoreBackup(
|
|||||||
GRANT ALL ON SCHEMA public TO public;
|
GRANT ALL ON SCHEMA public TO public;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
for await (const chunk of gunzip) {
|
for await (const chunk of inputStream) {
|
||||||
yield chunk;
|
yield chunk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user