sqlite: change path to paths

This commit is contained in:
Girish Ramakrishnan
2024-11-21 10:00:08 +05:30
parent 4316d3eade
commit fa98e0570f
3 changed files with 23 additions and 19 deletions

View File

@@ -911,14 +911,16 @@ async function backupSqlite(app, options) {
const volumeDataDir = await apps.getStorageDir(app);
const cmd = `sqlite3 ${options.path} ".dump"`;
const runCmd = `docker run --rm --name=sqlite-${app.id} \
--net cloudron \
-v ${volumeDataDir}:/app/data \
--label isCloudronManaged=true \
--read-only -v /tmp -v /run ${infra.images.base} ${cmd} > ${dumpPath('sqlite', app.id)}`;
for (const p of options.paths) {
const cmd = `sqlite3 ${p} ".dump"`;
const runCmd = `docker run --rm --name=sqlite-${app.id} \
--net cloudron \
-v ${volumeDataDir}:/app/data \
--label isCloudronManaged=true \
--read-only -v /tmp -v /run ${infra.images.base} ${cmd} > ${dumpPath('sqlite', app.id)}`;
await shell.bash(runCmd, { encoding: 'utf8' });
await shell.bash(runCmd, { encoding: 'utf8' });
}
}
async function backupLocalStorage(app, options) {
@@ -936,14 +938,16 @@ async function restoreSqlite(app, options) {
const volumeDataDir = await apps.getStorageDir(app);
const cmd = `sqlite3 ${options.path}`;
const runCmd = `docker run --rm --name=sqlite-${app.id} \
--net cloudron \
-v ${volumeDataDir}:/app/data \
--label isCloudronManaged=true \
--read-only -v /tmp -v /run ${infra.images.base} ${cmd} < ${dumpPath('sqlite', app.id)}`;
for (const p of options.paths) {
const cmd = `sqlite3 ${p}`;
const runCmd = `docker run --rm --name=sqlite-${app.id} \
--net cloudron \
-v ${volumeDataDir}:/app/data \
--label isCloudronManaged=true \
--read-only -v /tmp -v /run ${infra.images.base} ${cmd} < ${dumpPath('sqlite', app.id)}`;
await shell.bash(runCmd, { encoding: 'utf8' });
await shell.bash(runCmd, { encoding: 'utf8' });
}
}
async function restoreLocalStorage(app, options) {