Refactor + package updates + improve local backups
This commit is contained in:
@@ -11,9 +11,9 @@ return new class extends Migration {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->boolean('enabled')->default(true);
|
||||
$table->boolean('keep_locally')->default(false);
|
||||
$table->string('save_s3')->default(true);
|
||||
$table->string('frequency');
|
||||
$table->integer('number_of_backups_locally')->default(7);
|
||||
$table->morphs('database');
|
||||
$table->foreignId('team_id');
|
||||
$table->timestamps();
|
||||
|
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('scheduled_database_backup_executions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->enum('status', ['success', 'failed', 'running'])->default('running');
|
||||
$table->longText('message')->nullable();
|
||||
$table->text('size')->nullable();
|
||||
$table->text('filename')->nullable();
|
||||
$table->foreignId('scheduled_database_backup_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('scheduled_database_backup_executions');
|
||||
}
|
||||
};
|
@@ -32,7 +32,8 @@ class DatabaseSeeder extends Seeder
|
||||
LocalPersistentVolumeSeeder::class,
|
||||
S3StorageSeeder::class,
|
||||
StandalonePostgresqlSeeder::class,
|
||||
ScheduledDatabaseBackupSeeder::class
|
||||
ScheduledDatabaseBackupSeeder::class,
|
||||
ScheduledDatabaseBackupExecutionSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
28
database/seeders/ScheduledDatabaseBackupExecutionSeeder.php
Normal file
28
database/seeders/ScheduledDatabaseBackupExecutionSeeder.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ScheduledDatabaseBackupExecution;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ScheduledDatabaseBackupExecutionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
ScheduledDatabaseBackupExecution::create([
|
||||
'status' => 'success',
|
||||
'message' => 'Backup created successfully.',
|
||||
'size' => '10243467789556',
|
||||
'scheduled_database_backup_id' => 1,
|
||||
]);
|
||||
ScheduledDatabaseBackupExecution::create([
|
||||
'status' => 'failed',
|
||||
'message' => 'Backup failed.',
|
||||
'size' => '10243456',
|
||||
'scheduled_database_backup_id' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@ class ScheduledDatabaseBackupSeeder extends Seeder
|
||||
ScheduledDatabaseBackup::create([
|
||||
'enabled' => true,
|
||||
'frequency' => '* * * * *',
|
||||
'keep_locally' => true,
|
||||
'number_of_backups_locally' => 2,
|
||||
'database_id' => 1,
|
||||
'database_type' => 'App\Models\StandalonePostgresql',
|
||||
'team_id' => 0,
|
||||
|
Reference in New Issue
Block a user