mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
database backups
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\BackupStatus;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BackupFactory extends Factory
|
||||
@ -9,7 +10,10 @@ class BackupFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'type' => 'database',
|
||||
'interval' => '0 * * * *',
|
||||
'keep_backups' => 10,
|
||||
'status' => BackupStatus::RUNNING
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class StorageProviderFactory extends Factory
|
||||
@ -9,7 +10,10 @@ class StorageProviderFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'profile' => $this->faker->word(),
|
||||
'provider' => $this->faker->randomElement(\App\Enums\StorageProvider::getValues()),
|
||||
'credentials' => [],
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?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::table('storage_providers', function (Blueprint $table) {
|
||||
$table->dropColumn('token');
|
||||
$table->dropColumn('refresh_token');
|
||||
$table->dropColumn('token_expires_at');
|
||||
$table->dropColumn('label');
|
||||
$table->dropColumn('connected');
|
||||
$table->unsignedBigInteger('user_id')->after('id');
|
||||
$table->string('profile')->after('user_id');
|
||||
$table->longText('credentials')->nullable()->after('provider');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('storage_providers', function (Blueprint $table) {
|
||||
$table->string('token');
|
||||
$table->string('refresh_token');
|
||||
$table->string('token_expires_at');
|
||||
$table->string('label');
|
||||
$table->dropColumn('user_id');
|
||||
$table->dropColumn('profile');
|
||||
$table->dropColumn('credentials');
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1,21 @@
|
||||
<?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::table('backups', function (Blueprint $table) {
|
||||
$table->dropColumn('name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('backups', function (Blueprint $table) {
|
||||
$table->string('name')->nullable();
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1,21 @@
|
||||
<?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::table('backup_files', function (Blueprint $table) {
|
||||
$table->string('restored_to')->after('status')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('backup_files', function (Blueprint $table) {
|
||||
$table->dropColumn('restored_to');
|
||||
});
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user