Add phpstan level 7(#544)

This commit is contained in:
Saeed Vaziry
2025-03-12 13:31:10 +01:00
committed by GitHub
parent c22bb1fa80
commit 493cbb0849
437 changed files with 4505 additions and 2193 deletions

View File

@ -5,6 +5,9 @@
use App\Enums\BackupStatus;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Backup>
*/
class BackupFactory extends Factory
{
public function definition(): array

View File

@ -4,6 +4,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\BackupFile>
*/
class BackupFileFactory extends Factory
{
public function definition(): array

View File

@ -7,6 +7,9 @@
use App\Models\CommandExecution;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\CommandExecution>
*/
class CommandExecutionFactory extends Factory
{
protected $model = CommandExecution::class;

View File

@ -7,6 +7,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\Command>
*/
class CommandFactory extends Factory
{
protected $model = Command::class;

View File

@ -6,6 +6,9 @@
use App\Models\CronJob;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\CronJob>
*/
class CronJobFactory extends Factory
{
protected $model = CronJob::class;

View File

@ -6,6 +6,9 @@
use App\Models\Database;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Database>
*/
class DatabaseFactory extends Factory
{
protected $model = Database::class;

View File

@ -5,6 +5,9 @@
use App\Models\DatabaseUser;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\DatabaseUser>
*/
class DatabaseUserFactory extends Factory
{
protected $model = DatabaseUser::class;

View File

@ -5,6 +5,9 @@
use App\Models\Deployment;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Deployment>
*/
class DeploymentFactory extends Factory
{
protected $model = Deployment::class;

View File

@ -7,6 +7,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\DeploymentScript>
*/
class DeploymentScriptFactory extends Factory
{
protected $model = DeploymentScript::class;

View File

@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\File>
*/
class FileFactory extends Factory
{
protected $model = File::class;

View File

@ -5,6 +5,9 @@
use App\Models\FirewallRule;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\FirewallRule>
*/
class FirewallRuleFactory extends Factory
{
protected $model = FirewallRule::class;

View File

@ -8,6 +8,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\GitHook>
*/
class GitHookFactory extends Factory
{
protected $model = GitHook::class;

View File

@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\LoadBalancerServer>
*/
class LoadBalancerServerFactory extends Factory
{
protected $model = LoadBalancerServer::class;

View File

@ -4,6 +4,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Metric>
*/
class MetricFactory extends Factory
{
public function definition(): array

View File

@ -4,6 +4,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\NotificationChannel>
*/
class NotificationChannelFactory extends Factory
{
public function definition(): array

View File

@ -7,7 +7,7 @@
use Illuminate\Support\Carbon;
/**
* @extends Factory<Project>
* @extends Factory<\App\Models\Project>
*/
class ProjectFactory extends Factory
{

View File

@ -6,6 +6,9 @@
use App\Models\Queue;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Queue>
*/
class QueueFactory extends Factory
{
protected $model = Queue::class;

View File

@ -7,6 +7,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\ScriptExecution>
*/
class ScriptExecutionFactory extends Factory
{
protected $model = ScriptExecution::class;

View File

@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\Script>
*/
class ScriptFactory extends Factory
{
protected $model = Script::class;

View File

@ -9,6 +9,9 @@
use App\Models\Server;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Server>
*/
class ServerFactory extends Factory
{
protected $model = Server::class;

View File

@ -5,6 +5,9 @@
use App\Models\ServerLog;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\ServerLog>
*/
class ServerLogFactory extends Factory
{
protected $model = ServerLog::class;

View File

@ -6,6 +6,9 @@
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\ServerProvider>
*/
class ServerProviderFactory extends Factory
{
protected $model = ServerProvider::class;

View File

@ -5,6 +5,9 @@
use App\Models\Service;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Service>
*/
class ServiceFactory extends Factory
{
protected $model = Service::class;

View File

@ -6,6 +6,9 @@
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Site>
*/
class SiteFactory extends Factory
{
protected $model = Site::class;

View File

@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<\App\Models\SourceControl>
*/
class SourceControlFactory extends Factory
{
protected $model = SourceControl::class;
@ -20,30 +23,33 @@ public function definition(): array
];
}
/**
* @return Factory<\App\Models\SourceControl>
*/
public function gitlab(): Factory
{
return $this->state(function (array $attributes) {
return [
'provider' => \App\Enums\SourceControl::GITLAB,
];
});
return $this->state(fn (array $attributes): array => [
'provider' => \App\Enums\SourceControl::GITLAB,
]);
}
/**
* @return Factory<\App\Models\SourceControl>
*/
public function github(): Factory
{
return $this->state(function (array $attributes) {
return [
'provider' => \App\Enums\SourceControl::GITHUB,
];
});
return $this->state(fn (array $attributes): array => [
'provider' => \App\Enums\SourceControl::GITHUB,
]);
}
/**
* @return Factory<\App\Models\SourceControl>
*/
public function bitbucket(): Factory
{
return $this->state(function (array $attributes) {
return [
'provider' => \App\Enums\SourceControl::BITBUCKET,
];
});
return $this->state(fn (array $attributes): array => [
'provider' => \App\Enums\SourceControl::BITBUCKET,
]);
}
}

View File

@ -5,6 +5,9 @@
use App\Models\SshKey;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\SshKey>
*/
class SshKeyFactory extends Factory
{
protected $model = SshKey::class;

View File

@ -7,6 +7,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\Ssl>
*/
class SslFactory extends Factory
{
protected $model = Ssl::class;

View File

@ -5,6 +5,9 @@
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\StorageProvider>
*/
class StorageProviderFactory extends Factory
{
public function definition(): array

View File

@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
/**
* @extends Factory<\App\Models\Tag>
*/
class TagFactory extends Factory
{
protected $model = Tag::class;

View File

@ -7,6 +7,9 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
protected $model = User::class;

View File

@ -8,7 +8,7 @@ class CreateUsersTable extends Migration
{
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
Schema::create('users', function (Blueprint $table): void {
$table->id();
$table->string('name');
$table->string('email')->unique();

View File

@ -8,7 +8,7 @@ class CreatePasswordResetsTable extends Migration
{
public function up(): void
{
Schema::create('password_reset_tokens', function (Blueprint $table) {
Schema::create('password_reset_tokens', function (Blueprint $table): void {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();

View File

@ -21,7 +21,7 @@ public function up(): void
{
$schema = Schema::connection($this->getConnection());
$schema->create('telescope_entries', function (Blueprint $table) {
$schema->create('telescope_entries', function (Blueprint $table): void {
$table->bigIncrements('sequence');
$table->uuid('uuid');
$table->uuid('batch_id');
@ -38,7 +38,7 @@ public function up(): void
$table->index(['type', 'should_display_on_index']);
});
$schema->create('telescope_entries_tags', function (Blueprint $table) {
$schema->create('telescope_entries_tags', function (Blueprint $table): void {
$table->uuid('entry_uuid');
$table->string('tag');
@ -51,7 +51,7 @@ public function up(): void
->onDelete('cascade');
});
$schema->create('telescope_monitoring', function (Blueprint $table) {
$schema->create('telescope_monitoring', function (Blueprint $table): void {
$table->string('tag')->primary();
});
}

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('failed_jobs', function (Blueprint $table) {
Schema::create('failed_jobs', function (Blueprint $table): void {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
Schema::create('personal_access_tokens', function (Blueprint $table): void {
$table->id();
$table->morphs('tokenable');
$table->string('name');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('sessions', function (Blueprint $table) {
Schema::create('sessions', function (Blueprint $table): void {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('servers', function (Blueprint $table) {
Schema::create('servers', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('name')->index();

View File

@ -9,7 +9,7 @@
{
public function up(): void
{
Schema::create('services', function (Blueprint $table) {
Schema::create('services', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('type');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
Schema::create('jobs', function (Blueprint $table): void {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('server_logs', function (Blueprint $table) {
Schema::create('server_logs', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->unsignedBigInteger('site_id')->nullable();

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('sites', function (Blueprint $table) {
Schema::create('sites', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id')->index();
$table->string('type');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('source_controls', function (Blueprint $table) {
Schema::create('source_controls', function (Blueprint $table): void {
$table->id();
$table->string('provider');
$table->json('provider_data')->nullable();

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('deployments', function (Blueprint $table) {
Schema::create('deployments', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('site_id');
$table->unsignedBigInteger('deployment_script_id');

View File

@ -9,7 +9,7 @@
{
public function up(): void
{
Schema::create('databases', function (Blueprint $table) {
Schema::create('databases', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('name');

View File

@ -9,7 +9,7 @@
{
public function up(): void
{
Schema::create('database_users', function (Blueprint $table) {
Schema::create('database_users', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('username');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('firewall_rules', function (Blueprint $table) {
Schema::create('firewall_rules', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->string('type');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('cron_jobs', function (Blueprint $table) {
Schema::create('cron_jobs', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->text('command');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('deployment_scripts', function (Blueprint $table) {
Schema::create('deployment_scripts', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('site_id');
$table->string('name')->nullable();

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('ssls', function (Blueprint $table) {
Schema::create('ssls', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('site_id');
$table->string('type')->default('letsencrypt');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('redirects', function (Blueprint $table) {
Schema::create('redirects', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('site_id');
$table->integer('mode');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('queues', function (Blueprint $table) {
Schema::create('queues', function (Blueprint $table): void {
$table->id();
$table->unsignedInteger('server_id')->nullable();
$table->unsignedBigInteger('site_id');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('ssh_keys', function (Blueprint $table) {
Schema::create('ssh_keys', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('name');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('server_ssh_keys', function (Blueprint $table) {
Schema::create('server_ssh_keys', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->unsignedBigInteger('ssh_key_id');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('git_hooks', function (Blueprint $table) {
Schema::create('git_hooks', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('site_id');
$table->unsignedBigInteger('source_control_id');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('server_providers', function (Blueprint $table) {
Schema::create('server_providers', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('profile')->nullable();

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('scripts', function (Blueprint $table) {
Schema::create('scripts', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('name');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('script_executions', function (Blueprint $table) {
Schema::create('script_executions', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('script_id');
$table->unsignedBigInteger('server_id');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('notification_channels', function (Blueprint $table) {
Schema::create('notification_channels', function (Blueprint $table): void {
$table->id();
$table->string('provider');
$table->string('label');

View File

@ -8,7 +8,7 @@ class CreateStorageProvidersTable extends Migration
{
public function up(): void
{
Schema::create('storage_providers', function (Blueprint $table) {
Schema::create('storage_providers', function (Blueprint $table): void {
$table->id();
$table->string('provider');
$table->string('label')->nullable();

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('backups', function (Blueprint $table) {
Schema::create('backups', function (Blueprint $table): void {
$table->id();
$table->string('type');
$table->string('name');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('backup_files', function (Blueprint $table) {
Schema::create('backup_files', function (Blueprint $table): void {
$table->id();
$table->unsignedInteger('backup_id');
$table->string('name');

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->longText('ssh_key')->nullable()->after('repository');
});
}
public function down(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->dropColumn('ssh_key');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->string('url')->nullable()->after('provider');
});
}
public function down(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->dropColumn('url');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->string('profile')->after('provider')->nullable();
});
}
public function down(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->dropColumn('profile');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->unsignedBigInteger('source_control_id')->nullable()->after('source_control');
});
}
public function down(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->dropColumn('source_control_id');
});
}

View File

@ -8,25 +8,25 @@
{
public function up(): void
{
Schema::table('storage_providers', function (Blueprint $table) {
Schema::table('storage_providers', function (Blueprint $table): void {
$table->unsignedBigInteger('user_id')->after('id');
$table->string('profile')->after('user_id');
$table->longText('credentials')->nullable()->after('provider');
});
Schema::table('storage_providers', function (Blueprint $table) {
Schema::table('storage_providers', function (Blueprint $table): void {
$table->dropColumn(['token', 'refresh_token', 'token_expires_at', 'label', 'connected']);
});
}
public function down(): void
{
Schema::table('storage_providers', function (Blueprint $table) {
Schema::table('storage_providers', function (Blueprint $table): void {
$table->string('token')->nullable();
$table->string('refresh_token')->nullable();
$table->string('token_expires_at')->nullable();
$table->string('label')->nullable();
});
Schema::table('storage_providers', function (Blueprint $table) {
Schema::table('storage_providers', function (Blueprint $table): void {
$table->dropColumn(['user_id', 'profile', 'credentials']);
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('backups', function (Blueprint $table) {
Schema::table('backups', function (Blueprint $table): void {
$table->dropColumn('name');
});
}
public function down(): void
{
Schema::table('backups', function (Blueprint $table) {
Schema::table('backups', function (Blueprint $table): void {
$table->string('name')->nullable();
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('backup_files', function (Blueprint $table) {
Schema::table('backup_files', function (Blueprint $table): void {
$table->string('restored_to')->after('status')->nullable();
});
}
public function down(): void
{
Schema::table('backup_files', function (Blueprint $table) {
Schema::table('backup_files', function (Blueprint $table): void {
$table->dropColumn('restored_to');
});
}

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table): void {
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
@ -23,7 +23,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table): void {
$table->dropColumn([
'two_factor_confirmed_at',
]);

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('projects', function (Blueprint $table) {
Schema::create('projects', function (Blueprint $table): void {
$table->id();
$table->bigInteger('user_id');
$table->string('name');

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
Schema::table('servers', function (Blueprint $table): void {
$table->unsignedBigInteger('project_id')->nullable()->after('id');
});
}
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
Schema::table('servers', function (Blueprint $table): void {
$table->dropColumn('project_id');
});
}

View File

@ -9,10 +9,10 @@
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table): void {
$table->unsignedBigInteger('current_project_id')->nullable()->after('timezone');
});
User::query()->each(function (User $user) {
User::query()->each(function (User $user): void {
$project = $user->createDefaultProject();
$user->servers()->update(['project_id' => $project->id]);
});
@ -20,7 +20,7 @@ public function up(): void
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table): void {
$table->dropColumn('current_project_id');
});
}

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::table('server_logs', function (Blueprint $table) {
Schema::table('server_logs', function (Blueprint $table): void {
$table->boolean('is_remote')->default(false);
});
}
@ -21,7 +21,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('server_logs', function (Blueprint $table) {
Schema::table('server_logs', function (Blueprint $table): void {
$table->dropColumn('is_remote');
});
}

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::create('metrics', function (Blueprint $table) {
Schema::create('metrics', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('server_id');
$table->decimal('load', 5, 2);

View File

@ -13,7 +13,7 @@
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table): void {
$table->string('role')->default(UserRole::USER);
});
User::query()->update(['role' => UserRole::ADMIN]);
@ -24,7 +24,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', function (Blueprint $table): void {
$table->dropColumn('role');
});
}

View File

@ -13,16 +13,16 @@
*/
public function up(): void
{
Schema::create('user_project', function (Blueprint $table) {
Schema::create('user_project', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('project_id');
$table->timestamps();
});
Project::all()->each(function (Project $project) {
Project::all()->each(function (Project $project): void {
$project->users()->attach($project->user_id);
});
User::all()->each(function (User $user) {
User::all()->each(function (User $user): void {
$user->current_project_id = $user->projects()->first()?->id;
$user->save();
});

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::table('projects', function (Blueprint $table) {
Schema::table('projects', function (Blueprint $table): void {
$table->dropColumn('user_id');
});
}
@ -21,7 +21,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('projects', function (Blueprint $table) {
Schema::table('projects', function (Blueprint $table): void {
$table->bigInteger('user_id')->nullable();
});
}

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->unsignedBigInteger('project_id')->nullable();
});
}
@ -21,7 +21,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->dropColumn('project_id');
});
}

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
Schema::table('servers', function (Blueprint $table): void {
$table->integer('updates')->default(0);
$table->timestamp('last_update_check')->nullable();
});
@ -16,7 +16,7 @@ public function up(): void
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
Schema::table('servers', function (Blueprint $table): void {
$table->dropColumn('updates');
$table->dropColumn('last_update_check');
});

View File

@ -10,7 +10,7 @@ public function up(): void
{
Schema::dropIfExists('script_executions');
Schema::create('script_executions', function (Blueprint $table) {
Schema::create('script_executions', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('script_id');
$table->unsignedBigInteger('server_log_id')->nullable();

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('notification_channels', function (Blueprint $table) {
Schema::table('notification_channels', function (Blueprint $table): void {
$table->unsignedBigInteger('project_id')->nullable();
});
}
public function down(): void
{
Schema::table('notification_channels', function (Blueprint $table) {
Schema::table('notification_channels', function (Blueprint $table): void {
$table->dropColumn('project_id');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('storage_providers', function (Blueprint $table) {
Schema::table('storage_providers', function (Blueprint $table): void {
$table->unsignedBigInteger('project_id')->nullable();
});
}
public function down(): void
{
Schema::table('storage_providers', function (Blueprint $table) {
Schema::table('storage_providers', function (Blueprint $table): void {
$table->dropColumn('project_id');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('server_providers', function (Blueprint $table) {
Schema::table('server_providers', function (Blueprint $table): void {
$table->unsignedBigInteger('project_id')->nullable();
});
}
public function down(): void
{
Schema::table('server_providers', function (Blueprint $table) {
Schema::table('server_providers', function (Blueprint $table): void {
$table->dropColumn('project_id');
});
}

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('tags', function (Blueprint $table) {
Schema::create('tags', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('project_id');
$table->string('name');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('taggables', function (Blueprint $table) {
Schema::create('taggables', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('tag_id');
$table->unsignedBigInteger('taggable_id');

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('databases', function (Blueprint $table) {
Schema::table('databases', function (Blueprint $table): void {
$table->softDeletes();
});
}
public function down(): void
{
Schema::table('databases', function (Blueprint $table) {
Schema::table('databases', function (Blueprint $table): void {
$table->dropSoftDeletes();
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->softDeletes();
});
}
public function down(): void
{
Schema::table('source_controls', function (Blueprint $table) {
Schema::table('source_controls', function (Blueprint $table): void {
$table->dropSoftDeletes();
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('ssls', function (Blueprint $table) {
Schema::table('ssls', function (Blueprint $table): void {
$table->unsignedInteger('log_id')->nullable();
});
}
public function down(): void
{
Schema::table('ssls', function (Blueprint $table) {
Schema::table('ssls', function (Blueprint $table): void {
$table->dropColumn('log_id');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('ssh_keys', function (Blueprint $table) {
Schema::table('ssh_keys', function (Blueprint $table): void {
$table->softDeletes();
});
}
public function down(): void
{
Schema::table('ssh_keys', function (Blueprint $table) {
Schema::table('ssh_keys', function (Blueprint $table): void {
$table->dropSoftDeletes();
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('scripts', function (Blueprint $table) {
Schema::table('scripts', function (Blueprint $table): void {
$table->unsignedInteger('project_id')->nullable();
});
}
public function down(): void
{
Schema::table('scripts', function (Blueprint $table) {
Schema::table('scripts', function (Blueprint $table): void {
$table->dropColumn('project_id');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('script_executions', function (Blueprint $table) {
Schema::table('script_executions', function (Blueprint $table): void {
$table->unsignedInteger('server_id')->nullable();
});
}
public function down(): void
{
Schema::table('script_executions', function (Blueprint $table) {
Schema::table('script_executions', function (Blueprint $table): void {
$table->dropColumn('server_id');
});
}

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->string('user')->default(config('core.ssh_user'));
});
}
@ -21,7 +21,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->dropColumn('user');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->boolean('force_ssl')->default(false);
});
}
public function down(): void
{
Schema::table('sites', function (Blueprint $table) {
Schema::table('sites', function (Blueprint $table): void {
$table->dropColumn('force_ssl');
});
}

View File

@ -8,14 +8,14 @@
{
public function up(): void
{
Schema::table('ssls', function (Blueprint $table) {
Schema::table('ssls', function (Blueprint $table): void {
$table->string('email')->nullable();
});
}
public function down(): void
{
Schema::table('ssls', function (Blueprint $table) {
Schema::table('ssls', function (Blueprint $table): void {
$table->dropColumn('email');
});
}

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('load_balancer_servers', function (Blueprint $table) {
Schema::create('load_balancer_servers', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('load_balancer_id');
$table->string('ip');

View File

@ -10,13 +10,13 @@
{
public function up(): void
{
Schema::table('ssls', function (Blueprint $table) {
Schema::table('ssls', function (Blueprint $table): void {
$table->boolean('is_active')->default(false);
$table->string('certificate_path')->nullable();
$table->string('pk_path')->nullable();
$table->string('ca_path')->nullable();
});
Site::query()->chunk(100, function ($sites) {
Site::query()->chunk(100, function ($sites): void {
foreach ($sites as $site) {
foreach ($site->ssls as $ssl) {
if ($ssl->type === SslType::LETSENCRYPT) {
@ -44,7 +44,7 @@ public function up(): void
public function down(): void
{
Schema::table('ssls', function (Blueprint $table) {
Schema::table('ssls', function (Blueprint $table): void {
$table->dropColumn('is_active');
$table->dropColumn('certificate_path');
$table->dropColumn('pk_path');

View File

@ -8,7 +8,7 @@
{
public function up(): void
{
Schema::create('files', function (Blueprint $table) {
Schema::create('files', function (Blueprint $table): void {
$table->id();
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('server_id');

View File

@ -11,7 +11,7 @@
*/
public function up(): void
{
Schema::table('firewall_rules', function (Blueprint $table) {
Schema::table('firewall_rules', function (Blueprint $table): void {
$table->string('name')->default('Undefined')->after('id');
$table->ipAddress('source')->default(null)->nullable()->change();
});
@ -31,7 +31,7 @@ public function down(): void
DB::statement("UPDATE firewall_rules SET source = '0.0.0.0' WHERE source is null");
DB::statement("UPDATE firewall_rules SET mask = '0' WHERE mask is null");
Schema::table('firewall_rules', function (Blueprint $table) {
Schema::table('firewall_rules', function (Blueprint $table): void {
$table->dropColumn('name');
$table->ipAddress('source')->default('0.0.0.0')->change();
});

View File

@ -14,7 +14,7 @@
*/
public function up(): void
{
Schema::table('databases', function (Blueprint $table) {
Schema::table('databases', function (Blueprint $table): void {
$table->string('collation')->nullable();
$table->string('charset')->nullable();
});
@ -42,7 +42,7 @@ public function up(): void
*/
public function down(): void
{
Schema::table('databases', function (Blueprint $table) {
Schema::table('databases', function (Blueprint $table): void {
$table->dropColumn('collation');
$table->dropColumn('charset');
});

View File

@ -12,7 +12,7 @@
*/
public function up(): void
{
Schema::create('commands', function (Blueprint $table) {
Schema::create('commands', function (Blueprint $table): void {
$table->id();
$table->unsignedInteger('site_id');
$table->string('name');

Some files were not shown because too many files have changed in this diff Show More