This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class BackupFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class BackupFileFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Enums\CronjobStatus;
use App\Models\CronJob;
use Illuminate\Database\Eloquent\Factories\Factory;
class CronJobFactory extends Factory
{
protected $model = CronJob::class;
public function definition(): array
{
return [
'command' => 'ls -la',
'user' => 'root',
'frequency' => '* * * * *',
'hidden' => false,
'status' => CronjobStatus::READY,
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use App\Enums\DatabaseStatus;
use App\Models\Database;
use Illuminate\Database\Eloquent\Factories\Factory;
class DatabaseFactory extends Factory
{
protected $model = Database::class;
public function definition(): array
{
return [
'name' => $this->faker->userName,
'status' => DatabaseStatus::READY,
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use App\Models\DatabaseUser;
use Illuminate\Database\Eloquent\Factories\Factory;
class DatabaseUserFactory extends Factory
{
protected $model = DatabaseUser::class;
public function definition(): array
{
return [
'username' => $this->faker->userName,
'password' => 'password',
'databases' => [],
'host' => '%',
];
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Database\Factories;
use App\Models\Deployment;
use Illuminate\Database\Eloquent\Factories\Factory;
class DeploymentFactory extends Factory
{
protected $model = Deployment::class;
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use App\Models\DeploymentScript;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class DeploymentScriptFactory extends Factory
{
protected $model = DeploymentScript::class;
public function definition(): array
{
return [
'name' => $this->faker->name(),
'content' => $this->faker->word(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'site_id' => Site::factory(),
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\FirewallRule;
use Illuminate\Database\Eloquent\Factories\Factory;
class FirewallRuleFactory extends Factory
{
protected $model = FirewallRule::class;
public function definition(): array
{
return [
'type' => 'allow',
'protocol' => 'tcp',
'port' => $this->faker->numberBetween(1, 65535),
'source' => $this->faker->ipv4(),
'mask' => 24,
'note' => 'test',
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class NotificationChannelFactory extends Factory
{
public function definition(): array
{
return [
'label' => $this->faker->text(10),
'provider' => 'email',
'data' => [
'email' => $this->faker->email,
],
'connected' => 1,
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Enums\QueueStatus;
use App\Models\Queue;
use Illuminate\Database\Eloquent\Factories\Factory;
class QueueFactory extends Factory
{
protected $model = Queue::class;
public function definition(): array
{
return [
'command' => 'php artisan queue:work',
'user' => 'vito',
'auto_start' => 1,
'auto_restart' => 1,
'numprocs' => 1,
'redirect_stderr' => 1,
'stdout_logfile' => 'file.log',
'status' => QueueStatus::CREATING,
];
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use App\Models\Redirect;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class RedirectFactory extends Factory
{
protected $model = Redirect::class;
public function definition(): array
{
return [
'site_id' => $this->faker->randomNumber(),
'mode' => $this->faker->randomNumber(),
'from' => $this->faker->word(),
'to' => $this->faker->word(),
'status' => $this->faker->word(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Models\Script;
use App\Models\ScriptExecution;
use App\Models\Server;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class ScriptExecutionFactory extends Factory
{
protected $model = ScriptExecution::class;
public function definition(): array
{
return [
'user' => $this->faker->word(),
'finished_at' => Carbon::now(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'script_id' => Script::factory(),
'server_id' => Server::factory(),
];
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class ScriptFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Database\Factories;
use App\Enums\OperatingSystem;
use App\Enums\ServerProvider;
use App\Enums\ServerStatus;
use App\Enums\ServerType;
use App\Models\Server;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServerFactory extends Factory
{
protected $model = Server::class;
public function definition(): array
{
/** @var User $user */
$user = User::factory()->create();
return [
'user_id' => $user->id,
'name' => $this->faker->name(),
'ssh_user' => 'vito',
'ip' => $this->faker->ipv4(),
'local_ip' => $this->faker->ipv4(),
'port' => 22,
'os' => OperatingSystem::UBUNTU22,
'type' => ServerType::REGULAR,
'provider' => ServerProvider::CUSTOM,
'authentication' => [
'user' => 'vito',
'pass' => 'password',
],
'public_key' => 'test',
'status' => ServerStatus::READY,
'progress' => 100,
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use App\Enums\LogType;
use App\Models\ServerLog;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServerLogFactory extends Factory
{
protected $model = ServerLog::class;
public function definition(): array
{
return [
'type' => 'test-log',
'name' => 'test.log',
'disk' => 'server-logs-local',
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\ServerProvider;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServerProviderFactory extends Factory
{
protected $model = ServerProvider::class;
public function definition(): array
{
return [
'profile' => $this->faker->word(),
'provider' => $this->faker->randomElement(\App\Enums\ServerProvider::getValues()),
'credentials' => [],
'connected' => 1,
'user_id' => User::factory(),
];
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Database\Factories;
use App\Models\Server;
use App\Models\Service;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class ServiceFactory extends Factory
{
protected $model = Service::class;
public function definition(): array
{
return [
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Enums\SiteType;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
class SiteFactory extends Factory
{
protected $model = Site::class;
public function definition(): array
{
return [
'type' => SiteType::LARAVEL,
'domain' => 'test.com',
'web_directory' => '/',
'path' => '/home',
'status' => 'ready',
'progress' => '100',
'php_version' => '8.2',
'branch' => 'main'
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use App\Models\SourceControl;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class SourceControlFactory extends Factory
{
protected $model = SourceControl::class;
public function definition(): array
{
return [
'provider' => $this->faker->randomElement(\App\Enums\SourceControl::getValues()),
'access_token' => Str::random(10),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use App\Models\SshKey;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class SshKeyFactory extends Factory
{
protected $model = SshKey::class;
public function definition(): array
{
return [
'name' => $this->faker->name(),
'public_key' => 'public-key-content',
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Enums\SslStatus;
use App\Models\Ssl;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class SslFactory extends Factory
{
protected $model = Ssl::class;
public function definition(): array
{
return [
'type' => $this->faker->word(),
'certificate' => $this->faker->word(),
'pk' => $this->faker->word(),
'ca' => $this->faker->word(),
'expires_at' => Carbon::now()->addDay(),
'status' => SslStatus::CREATED,
'domains' => 'example.com',
];
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class StorageProviderFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
protected $model = User::class;
public function definition(): array
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
'timezone' => 'UTC',
];
}
}

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->string('profile_photo_path', 2048)->nullable();
$table->text('two_factor_secret')->nullable();
$table->text('two_factor_recovery_codes')->nullable();
$table->string('timezone')->default('UTC');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('users');
}
}

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
public function up(): void
{
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
}

View File

@ -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('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,27 @@
<?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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@ -0,0 +1,25 @@
<?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('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity')->index();
});
}
public function down(): void
{
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,38 @@
<?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('servers', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('name')->index();
$table->string('ssh_user')->nullable();
$table->ipAddress('ip')->index()->nullable();
$table->ipAddress('local_ip')->nullable();
$table->unsignedInteger('provider_id')->nullable();
$table->integer('port')->default(22);
$table->string('os');
$table->string('type');
$table->json('type_data')->nullable();
$table->string('provider');
$table->json('provider_data')->nullable();
$table->longText('authentication')->nullable();
$table->longText('public_key')->nullable();
$table->string('status')->default('installing');
$table->tinyInteger('progress')->default(0);
$table->string('progress_step')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('servers');
}
};

View File

@ -0,0 +1,30 @@
<?php
use App\Enums\ServiceStatus;
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('services', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('type');
$table->json('type_data')->nullable();
$table->string('name');
$table->string('version');
$table->enum('status', ServiceStatus::getValues())->default(ServiceStatus::INSTALLING);
$table->boolean('is_default')->default(1);
$table->string('unit')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('services');
}
};

View File

@ -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('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
public function down(): void
{
Schema::dropIfExists('jobs');
}
};

View File

@ -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('server_logs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->unsignedBigInteger('site_id')->nullable();
$table->string('type');
$table->string('name');
$table->string('disk');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('server_logs');
}
};

View File

@ -0,0 +1,35 @@
<?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('sites', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id')->index();
$table->string('type');
$table->json('type_data')->nullable();
$table->string('domain')->index();
$table->json('aliases')->nullable();
$table->string('web_directory')->nullable();
$table->string('path');
$table->string('php_version')->nullable();
$table->string('source_control')->nullable();
$table->string('repository')->nullable();
$table->string('branch')->nullable();
$table->integer('port')->nullable();
$table->string('status')->default('installing');
$table->tinyInteger('progress')->default(0);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('sites');
}
};

View File

@ -0,0 +1,23 @@
<?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('source_controls', function (Blueprint $table) {
$table->id();
$table->string('provider');
$table->longText('access_token');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('source_controls');
}
};

View File

@ -0,0 +1,28 @@
<?php
use App\Enums\DeploymentStatus;
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('deployments', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('site_id');
$table->unsignedBigInteger('deployment_script_id');
$table->unsignedInteger('log_id')->nullable();
$table->json('commit_data')->nullable();
$table->string('commit_id')->nullable();
$table->enum('status', DeploymentStatus::getValues());
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('deployments');
}
};

View File

@ -0,0 +1,25 @@
<?php
use App\Enums\DatabaseStatus;
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('databases', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('name');
$table->enum('status', DatabaseStatus::getValues())->default(DatabaseStatus::CREATING);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('databases');
}
};

View File

@ -0,0 +1,28 @@
<?php
use App\Enums\DatabaseUserStatus;
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('database_users', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('username');
$table->longText('password')->nullable();
$table->json('databases')->nullable();
$table->string('host')->default('localhost');
$table->enum('status', DatabaseUserStatus::getValues())->default(DatabaseUserStatus::CREATING);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('database_users');
}
};

View File

@ -0,0 +1,29 @@
<?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('firewall_rules', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('type');
$table->string('protocol');
$table->integer('port');
$table->ipAddress('source')->default('0.0.0.0');
$table->tinyInteger('mask')->default(0);
$table->text('note')->nullable();
$table->string('status')->default('creating');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('firewall_rules');
}
};

View File

@ -0,0 +1,28 @@
<?php
use App\Enums\CronjobStatus;
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('cron_jobs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->text('command');
$table->string('user');
$table->string('frequency');
$table->boolean('hidden')->default(0);
$table->enum('status', CronjobStatus::getValues());
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('cron_jobs');
}
};

View File

@ -0,0 +1,24 @@
<?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('deployment_scripts', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('site_id');
$table->string('name')->nullable();
$table->longText('content')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('deployment_scripts');
}
};

View File

@ -0,0 +1,30 @@
<?php
use App\Enums\SslStatus;
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('ssls', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('site_id');
$table->string('type')->default('letsencrypt');
$table->string('domains')->nullable();
$table->longText('certificate')->nullable();
$table->longText('pk')->nullable();
$table->longText('ca')->nullable();
$table->timestamp('expires_at');
$table->enum('status', SslStatus::getValues());
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('ssls');
}
};

View File

@ -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('redirects', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('site_id');
$table->integer('mode');
$table->text('from');
$table->text('to');
$table->string('status')->default('creating');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('redirects');
}
};

View File

@ -0,0 +1,32 @@
<?php
use App\Enums\QueueStatus;
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('queues', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('server_id')->nullable();
$table->unsignedBigInteger('site_id');
$table->text('command');
$table->string('user');
$table->boolean('auto_start')->default(1);
$table->boolean('auto_restart')->default(1);
$table->tinyInteger('numprocs')->default(8);
$table->boolean('redirect_stderr')->default(1);
$table->string('stdout_logfile')->nullable();
$table->enum('status', QueueStatus::getValues());
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('queues');
}
};

View File

@ -0,0 +1,24 @@
<?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('ssh_keys', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('name');
$table->longText('public_key');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('ssh_keys');
}
};

View File

@ -0,0 +1,25 @@
<?php
use App\Enums\SshKeyStatus;
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('server_ssh_keys', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('server_id');
$table->unsignedBigInteger('ssh_key_id');
$table->enum('status', SshKeyStatus::getValues());
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('server_ssh_keys');
}
};

View File

@ -0,0 +1,28 @@
<?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('git_hooks', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('site_id');
$table->unsignedBigInteger('source_control_id');
$table->string('secret')->unique()->index();
$table->json('events');
$table->json('actions');
$table->string('hook_id')->nullable();
$table->json('hook_response')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('git_hooks');
}
};

View File

@ -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('server_providers', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('profile')->nullable();
$table->string('provider');
$table->longText('credentials');
$table->boolean('connected')->default(1);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('server_providers');
}
};

View File

@ -0,0 +1,24 @@
<?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('scripts', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('name');
$table->longText('content');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('scripts');
}
};

View File

@ -0,0 +1,25 @@
<?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('script_executions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('script_id');
$table->unsignedBigInteger('server_id');
$table->string('user')->nullable();
$table->timestamp('finished_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('script_executions');
}
};

View File

@ -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('notification_channels', function (Blueprint $table) {
$table->id();
$table->string('provider');
$table->string('label');
$table->json('data')->nullable();
$table->boolean('connected')->default(false);
$table->boolean('is_default')->default(false);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notification_channels');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStorageProvidersTable extends Migration
{
public function up(): void
{
Schema::create('storage_providers', function (Blueprint $table) {
$table->id();
$table->string('provider');
$table->string('label')->nullable();
$table->string('token', 1000)->nullable();
$table->string('refresh_token', 1000)->nullable();
$table->boolean('connected')->default(1);
$table->timestamp('token_expires_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('storage_providers');
}
}

View File

@ -0,0 +1,29 @@
<?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('backups', function (Blueprint $table) {
$table->id();
$table->string('type');
$table->string('name');
$table->unsignedBigInteger('server_id');
$table->unsignedBigInteger('storage_id');
$table->unsignedBigInteger('database_id')->nullable();
$table->string('interval');
$table->bigInteger('keep_backups');
$table->string('status');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('backups');
}
};

View File

@ -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('backup_files', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('backup_id');
$table->string('name');
$table->bigInteger('size')->nullable();
$table->string('status');
$table->timestamp('restored_at')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('backup_files');
}
};

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
User::factory()->create([
'name' => 'Test User',
'email' => 'user@example.com',
]);
}
}