Skip to content

Commit

Permalink
fix: Supported database size
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Jul 27, 2024
1 parent 8e4e39f commit b580e1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Services/Backup/Tasks/DatabaseBackupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ protected function performBackup(): void
$dumpFileName = $this->generateBackupFileName('sql');
$remoteDumpPath = '/tmp/' . $dumpFileName;

$dirSize = $this->getRemoteDirectorySize($sftp, $remoteDumpPath);
$this->backupSize = $dirSize;

$this->dumpRemoteDatabase($sftp, $databaseType, $remoteDumpPath, $databasePassword, $databaseName, $this->backupTask->getAttribute('excluded_database_tables'));

if (! $this->backupDestinationDriver($backupDestinationModel->type, $sftp, $remoteDumpPath, $backupDestinationModel, $dumpFileName, $storagePath)) {
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Services/Backup/Tasks/DatabaseBackupTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
$this->databaseBackupTask->shouldReceive('getDatabaseType')->andReturn(BackupConstants::DATABASE_TYPE_MYSQL);
$this->databaseBackupTask->shouldReceive('dumpRemoteDatabase')->andReturnNull();
$this->databaseBackupTask->shouldReceive('createBackupDestinationInstance')->andReturn($this->s3Mock);
$this->databaseBackupTask->shouldReceive('getRemoteDirectorySize')->andReturn('500');
$this->databaseBackupTask->shouldReceive('rotateOldBackups')->andReturnNull();

$this->databaseBackupTask->shouldReceive('updateBackupTaskStatus')->twice();
Expand Down Expand Up @@ -145,6 +146,7 @@
$this->databaseBackupTask->shouldReceive('dumpRemoteDatabase')->andReturnNull();
$this->databaseBackupTask->shouldReceive('createBackupDestinationInstance')->andReturn($this->s3Mock);
$this->databaseBackupTask->shouldReceive('rotateOldBackups')->once()->andReturnNull();
$this->databaseBackupTask->shouldReceive('getRemoteDirectorySize')->andReturn('500');

$this->databaseBackupTask->shouldReceive('updateBackupTaskStatus')->twice();

Expand Down

0 comments on commit b580e1c

Please sign in to comment.