mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Merge (#127)
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
<?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(),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?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(),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ScriptFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ public function definition(): array
|
||||
return [
|
||||
'type' => 'test-log',
|
||||
'name' => 'test.log',
|
||||
'disk' => 'server-logs-local',
|
||||
'disk' => 'server-logs',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'profile' => $this->faker->word(),
|
||||
'provider' => $this->faker->randomElement(\App\Enums\ServerProvider::getValues()),
|
||||
'provider' => $this->faker->randomElement(config('core.server_providers')),
|
||||
'credentials' => [],
|
||||
'connected' => 1,
|
||||
'user_id' => User::factory(),
|
||||
|
@ -11,8 +11,10 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'profile' => $this->faker->word(),
|
||||
'provider' => $this->faker->randomElement(\App\Enums\StorageProvider::getValues()),
|
||||
'credentials' => [],
|
||||
'provider' => $this->faker->randomElement(config('core.storage_providers')),
|
||||
'credentials' => [
|
||||
'token' => 'test-token',
|
||||
],
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public function up(): void
|
||||
$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->string('timezone')->default('UTC')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Get the migration connection name.
|
||||
*/
|
||||
public function getConnection(): ?string
|
||||
{
|
||||
return config('telescope.storage.database.connection');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$schema = Schema::connection($this->getConnection());
|
||||
|
||||
$schema->create('telescope_entries', function (Blueprint $table) {
|
||||
$table->bigIncrements('sequence');
|
||||
$table->uuid('uuid');
|
||||
$table->uuid('batch_id');
|
||||
$table->string('family_hash')->nullable();
|
||||
$table->boolean('should_display_on_index')->default(true);
|
||||
$table->string('type', 20);
|
||||
$table->longText('content');
|
||||
$table->dateTime('created_at')->nullable();
|
||||
|
||||
$table->unique('uuid');
|
||||
$table->index('batch_id');
|
||||
$table->index('family_hash');
|
||||
$table->index('created_at');
|
||||
$table->index(['type', 'should_display_on_index']);
|
||||
});
|
||||
|
||||
$schema->create('telescope_entries_tags', function (Blueprint $table) {
|
||||
$table->uuid('entry_uuid');
|
||||
$table->string('tag');
|
||||
|
||||
$table->primary(['entry_uuid', 'tag']);
|
||||
$table->index('tag');
|
||||
|
||||
$table->foreign('entry_uuid')
|
||||
->references('uuid')
|
||||
->on('telescope_entries')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
$schema->create('telescope_monitoring', function (Blueprint $table) {
|
||||
$table->string('tag')->primary();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$schema = Schema::connection($this->getConnection());
|
||||
|
||||
$schema->dropIfExists('telescope_entries_tags');
|
||||
$schema->dropIfExists('telescope_entries');
|
||||
$schema->dropIfExists('telescope_monitoring');
|
||||
}
|
||||
};
|
@ -25,7 +25,7 @@ public function up(): void
|
||||
$table->longText('authentication')->nullable();
|
||||
$table->longText('public_key')->nullable();
|
||||
$table->string('status')->default('installing');
|
||||
$table->tinyInteger('progress')->default(0);
|
||||
$table->integer('progress')->default(0);
|
||||
$table->string('progress_step')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ public function up(): void
|
||||
$table->json('type_data')->nullable();
|
||||
$table->string('name');
|
||||
$table->string('version');
|
||||
$table->enum('status', ServiceStatus::getValues())->default(ServiceStatus::INSTALLING);
|
||||
$table->string('status')->default(ServiceStatus::INSTALLING);
|
||||
$table->boolean('is_default')->default(1);
|
||||
$table->string('unit')->nullable();
|
||||
$table->timestamps();
|
||||
|
@ -12,10 +12,10 @@ public function up(): void
|
||||
$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');
|
||||
$table->integer('attempts');
|
||||
$table->integer('reserved_at')->nullable();
|
||||
$table->integer('available_at');
|
||||
$table->integer('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public function up(): void
|
||||
$table->string('branch')->nullable();
|
||||
$table->integer('port')->nullable();
|
||||
$table->string('status')->default('installing');
|
||||
$table->tinyInteger('progress')->default(0);
|
||||
$table->integer('progress')->default(0)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ public function up(): void
|
||||
Schema::create('source_controls', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('provider');
|
||||
$table->longText('access_token');
|
||||
$table->json('provider_data')->nullable();
|
||||
$table->longText('access_token')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\DeploymentStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,7 +15,7 @@ public function up(): void
|
||||
$table->unsignedInteger('log_id')->nullable();
|
||||
$table->json('commit_data')->nullable();
|
||||
$table->string('commit_id')->nullable();
|
||||
$table->enum('status', DeploymentStatus::getValues());
|
||||
$table->string('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('server_id');
|
||||
$table->string('name');
|
||||
$table->enum('status', DatabaseStatus::getValues())->default(DatabaseStatus::CREATING);
|
||||
$table->string('status')->default(DatabaseStatus::CREATING);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public function up(): void
|
||||
$table->longText('password')->nullable();
|
||||
$table->json('databases')->nullable();
|
||||
$table->string('host')->default('localhost');
|
||||
$table->enum('status', DatabaseUserStatus::getValues())->default(DatabaseUserStatus::CREATING);
|
||||
$table->string('status')->default(DatabaseUserStatus::CREATING);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public function up(): void
|
||||
$table->string('protocol');
|
||||
$table->integer('port');
|
||||
$table->ipAddress('source')->default('0.0.0.0');
|
||||
$table->tinyInteger('mask')->default(0);
|
||||
$table->string('mask')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->string('status')->default('creating');
|
||||
$table->timestamps();
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\CronjobStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,7 +15,7 @@ public function up(): void
|
||||
$table->string('user');
|
||||
$table->string('frequency');
|
||||
$table->boolean('hidden')->default(0);
|
||||
$table->enum('status', CronjobStatus::getValues());
|
||||
$table->string('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\SslStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -18,7 +17,7 @@ public function up(): void
|
||||
$table->longText('pk')->nullable();
|
||||
$table->longText('ca')->nullable();
|
||||
$table->timestamp('expires_at');
|
||||
$table->enum('status', SslStatus::getValues());
|
||||
$table->string('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -17,10 +16,10 @@ public function up(): void
|
||||
$table->string('user');
|
||||
$table->boolean('auto_start')->default(1);
|
||||
$table->boolean('auto_restart')->default(1);
|
||||
$table->tinyInteger('numprocs')->default(8);
|
||||
$table->integer('numprocs')->default(8);
|
||||
$table->boolean('redirect_stderr')->default(1);
|
||||
$table->string('stdout_logfile')->nullable();
|
||||
$table->enum('status', QueueStatus::getValues());
|
||||
$table->string('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\SshKeyStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -13,7 +12,7 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('server_id');
|
||||
$table->unsignedBigInteger('ssh_key_id');
|
||||
$table->enum('status', SshKeyStatus::getValues());
|
||||
$table->string('status');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -7,7 +7,9 @@
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement('ALTER TABLE firewall_rules MODIFY mask varchar(10) null');
|
||||
if (DB::getDriverName() === 'mysql') {
|
||||
DB::statement('ALTER TABLE firewall_rules MODIFY mask varchar(10) null');
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
|
@ -23,10 +23,10 @@ public function up(): void
|
||||
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->string('token')->nullable();
|
||||
$table->string('refresh_token')->nullable();
|
||||
$table->string('token_expires_at')->nullable();
|
||||
$table->string('label')->nullable();
|
||||
$table->dropColumn('user_id');
|
||||
$table->dropColumn('profile');
|
||||
$table->dropColumn('credentials');
|
||||
|
@ -45,6 +45,12 @@ public function run(): void
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
$server->services()->create([
|
||||
'type' => 'firewall',
|
||||
'name' => 'ufw',
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
Site::factory()->create([
|
||||
'server_id' => $server->id,
|
||||
'type' => SiteType::LARAVEL,
|
||||
|
Reference in New Issue
Block a user