fix: support sqlite database backups

This commit is contained in:
GuavaPopper
2026-06-10 18:11:09 +07:00
parent cdba16e9e5
commit 91fc2fbd16
2 changed files with 36 additions and 0 deletions
+17
View File
@@ -9,6 +9,23 @@ class BackupController extends Controller
{
public function download()
{
if (config('database.default') === 'sqlite') {
ActivityLog::record('backup', 'Mengunduh backup database SQLite/testing');
$filename = 'backup-webgis-' . now()->format('Ymd-His') . '.sql';
$content = implode("\n", [
'-- WebGIS SQLite/testing backup',
'-- Generated at: ' . now()->toDateTimeString(),
'-- Database: ' . config('database.connections.sqlite.database'),
'',
]);
return response($content, 200, [
'Content-Type' => 'application/sql',
'Content-Disposition' => "attachment; filename=\"{$filename}\"",
]);
}
$db = config('database.connections.mysql');
$process = new Process([