Update all dependencies (#712)

* update composer.lock

* run pint

* fix phpstan

* update migrations (sqlite `dropForeign`)

* fix migrations

* Reset these back for now

* Alphabetize the rules

* run `php artisan filament:upgrade`

---------

Co-authored-by: Lance Pioch <git@lance.sh>
This commit is contained in:
Boy132 2024-11-22 09:27:57 +01:00 committed by GitHub
parent f33f91698e
commit d555c42644
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
124 changed files with 979 additions and 1428 deletions

View File

@ -65,6 +65,7 @@ class BulkPowerActionCommand extends Command
$bar = $this->output->createProgressBar($count);
$powerRepository = $this->powerRepository;
// @phpstan-ignore-next-line
$this->getQueryBuilder($servers, $nodes)->each(function (Server $server) use ($action, $powerRepository, &$bar) {
$bar->clear();

View File

@ -8,9 +8,7 @@ use Illuminate\Database\Eloquent\Model;
class ActivityLogged extends Event
{
public function __construct(public ActivityLog $model)
{
}
public function __construct(public ActivityLog $model) {}
public function is(string $event): bool
{

View File

@ -7,7 +7,5 @@ use App\Events\Event;
class DirectLogin extends Event
{
public function __construct(public User $user, public bool $remember)
{
}
public function __construct(public User $user, public bool $remember) {}
}

View File

@ -12,7 +12,5 @@ class FailedCaptcha extends Event
/**
* Create a new event instance.
*/
public function __construct(public string $ip, public ?string $message)
{
}
public function __construct(public string $ip, public ?string $message) {}
}

View File

@ -12,7 +12,5 @@ class FailedPasswordReset extends Event
/**
* Create a new event instance.
*/
public function __construct(public string $ip, public string $email)
{
}
public function __construct(public string $ip, public string $email) {}
}

View File

@ -7,7 +7,5 @@ use App\Events\Event;
class ProvidedAuthenticationToken extends Event
{
public function __construct(public User $user, public bool $recovery = false)
{
}
public function __construct(public User $user, public bool $recovery = false) {}
}

View File

@ -2,6 +2,4 @@
namespace App\Events;
abstract class Event
{
}
abstract class Event {}

View File

@ -13,7 +13,5 @@ class Installed extends Event
/**
* Create a new event instance.
*/
public function __construct(public Server $server)
{
}
public function __construct(public Server $server) {}
}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Http\Base;
use App\Exceptions\DisplayException;
class InvalidPasswordProvidedException extends DisplayException
{
}
class InvalidPasswordProvidedException extends DisplayException {}

View File

@ -2,6 +2,4 @@
namespace App\Exceptions;
class PanelException extends \Exception
{
}
class PanelException extends \Exception {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Repository;
use App\Exceptions\DisplayException;
class DuplicateDatabaseNameException extends DisplayException
{
}
class DuplicateDatabaseNameException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Allocation;
use App\Exceptions\DisplayException;
class ServerUsingAllocationException extends DisplayException
{
}
class ServerUsingAllocationException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Deployment;
use App\Exceptions\DisplayException;
class NoViableAllocationException extends DisplayException
{
}
class NoViableAllocationException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Egg;
use App\Exceptions\DisplayException;
class HasChildrenException extends DisplayException
{
}
class HasChildrenException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Egg\Variable;
use App\Exceptions\DisplayException;
class BadValidationRuleException extends DisplayException
{
}
class BadValidationRuleException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Egg\Variable;
use App\Exceptions\DisplayException;
class ReservedVariableNameException extends DisplayException
{
}
class ReservedVariableNameException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service;
use App\Exceptions\DisplayException;
class InvalidFileUploadException extends DisplayException
{
}
class InvalidFileUploadException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Node;
use App\Exceptions\DisplayException;
class ConfigurationNotPersistedException extends DisplayException
{
}
class ConfigurationNotPersistedException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Subuser;
use App\Exceptions\DisplayException;
class ServerSubuserExistsException extends DisplayException
{
}
class ServerSubuserExistsException extends DisplayException {}

View File

@ -4,6 +4,4 @@ namespace App\Exceptions\Service\Subuser;
use App\Exceptions\DisplayException;
class UserIsServerOwnerException extends DisplayException
{
}
class UserIsServerOwnerException extends DisplayException {}

View File

@ -27,9 +27,7 @@ class BackupManager
/**
* BackupManager constructor.
*/
public function __construct(protected Application $app)
{
}
public function __construct(protected Application $app) {}
/**
* Returns a backup adapter instance.

View File

@ -289,7 +289,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile
if ($token = $data['2facode'] ?? null) {
$tokens = $this->toggleTwoFactorService->handle($record, $token, true);
cache()->set("users.$record->id.2fa.tokens", implode("\n", $tokens), now()->addSeconds(15));
cache()->put("users.$record->id.2fa.tokens", implode("\n", $tokens), now()->addSeconds(15));
$this->redirectRoute('filament.admin.auth.profile', ['tab' => '-2fa-tab']);
}

View File

@ -20,9 +20,7 @@ class BackupRemoteUploadController extends Controller
/**
* BackupRemoteUploadController constructor.
*/
public function __construct(private BackupManager $backupManager)
{
}
public function __construct(private BackupManager $backupManager) {}
/**
* Returns the required presigned urls to upload a backup to S3 cloud storage.

View File

@ -20,9 +20,7 @@ class BackupStatusController extends Controller
/**
* BackupStatusController constructor.
*/
public function __construct(private BackupManager $backupManager)
{
}
public function __construct(private BackupManager $backupManager) {}
/**
* Handles updating the state of a backup.

View File

@ -16,7 +16,7 @@ class ServerContainersController extends Controller
{
$status = fluent($request->json()->all())->get('data.new_state');
cache()->set("servers.$server->uuid.container.status", $status, now()->addHour());
cache()->put("servers.$server->uuid.container.status", $status, now()->addHour());
return new JsonResponse([]);
}

View File

@ -23,8 +23,7 @@ class ServerDetailsController extends Controller
protected ConnectionInterface $connection,
private ServerConfigurationStructureService $configurationStructureService,
private EggConfigurationService $eggConfigurationService
) {
}
) {}
/**
* Returns details about the server that allows daemon to self-recover and ensure

View File

@ -21,8 +21,7 @@ class ServerTransferController extends Controller
public function __construct(
private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository,
) {
}
) {}
/**
* The daemon notifies us about a transfer failure.

View File

@ -22,9 +22,7 @@ class SftpAuthenticationController extends Controller
{
use ThrottlesLogins;
public function __construct(protected GetUserPermissionsService $permissions)
{
}
public function __construct(protected GetUserPermissionsService $permissions) {}
/**
* Authenticate a set of credentials and return the associated server details

View File

@ -19,8 +19,7 @@ class OAuthController extends Controller
public function __construct(
private AuthManager $auth,
private UserUpdateService $updateService
) {
}
) {}
/**
* Redirect user to the OAuth provider

View File

@ -29,8 +29,7 @@ class ResetPasswordController extends Controller
*/
public function __construct(
private Hasher $hasher,
) {
}
) {}
/**
* Reset the given user's password.

View File

@ -11,9 +11,7 @@ class IndexController extends Controller
/**
* IndexController constructor.
*/
public function __construct(protected ViewFactory $view)
{
}
public function __construct(protected ViewFactory $view) {}
/**
* Returns listing of user's servers.

View File

@ -16,8 +16,7 @@ class OAuthController extends Controller
*/
public function __construct(
private UserUpdateService $updateService
) {
}
) {}
/**
* Link a new OAuth

View File

@ -19,9 +19,7 @@ class AuthenticateServerAccess
/**
* AuthenticateServerAccess constructor.
*/
public function __construct()
{
}
public function __construct() {}
/**
* Authenticate that this server exists and is not suspended or marked as installing.

View File

@ -10,9 +10,7 @@ class LanguageMiddleware
/**
* LanguageMiddleware constructor.
*/
public function __construct(private Application $app)
{
}
public function __construct(private Application $app) {}
/**
* Handle an incoming request and set the user's preferred language.

View File

@ -10,9 +10,7 @@ class MaintenanceMiddleware
/**
* MaintenanceMiddleware constructor.
*/
public function __construct(private ResponseFactory $response)
{
}
public function __construct(private ResponseFactory $response) {}
/**
* Handle an incoming request.

View File

@ -10,9 +10,7 @@ class RedirectIfAuthenticated
/**
* RedirectIfAuthenticated constructor.
*/
public function __construct(private AuthManager $authManager)
{
}
public function __construct(private AuthManager $authManager) {}
/**
* Handle an incoming request.

View File

@ -11,10 +11,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
readonly class VerifyReCaptcha
{
public function __construct(private Application $app)
{
}
public function __construct(private Application $app) {}
public function handle(Request $request, \Closure $next): mixed
{

View File

@ -2,6 +2,4 @@
namespace App\Http\Requests\Api\Application\Nodes;
class GetNodeRequest extends GetNodesRequest
{
}
class GetNodeRequest extends GetNodesRequest {}

View File

@ -2,6 +2,4 @@
namespace App\Http\Requests\Api\Application\Roles;
class UpdateRoleRequest extends StoreRoleRequest
{
}
class UpdateRoleRequest extends StoreRoleRequest {}

View File

@ -7,9 +7,7 @@ use Illuminate\View\View;
readonly class AssetComposer
{
public function __construct(private AssetHashService $assetHashService)
{
}
public function __construct(private AssetHashService $assetHashService) {}
public function compose(View $view): void
{

View File

@ -18,8 +18,7 @@ class ProcessWebhook implements ShouldQueue
private WebhookConfiguration $webhookConfiguration,
private string $eventName,
private array $data
) {
}
) {}
public function handle(): void
{

View File

@ -23,10 +23,7 @@ class RunTaskJob extends Job implements ShouldQueue
/**
* RunTaskJob constructor.
*/
public function __construct(public Task $task, public bool $manualRun = false)
{
}
public function __construct(public Task $task, public bool $manualRun = false) {}
/**
* Run the job and send actions to the daemon running the server.

View File

@ -17,7 +17,8 @@ class DispatchWebhooks
return WebhookConfiguration::query()->whereJsonContains('events', $eventName)->get();
});
foreach ($matchingHooks ?? [] as $webhookConfig) {
/** @var WebhookConfiguration $webhookConfig */
foreach ($matchingHooks as $webhookConfig) {
if (in_array($eventName, $webhookConfig->events)) {
ProcessWebhook::dispatch($webhookConfig, $eventName, $data);
}

View File

@ -8,6 +8,14 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\MassPrunable;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $event
* @property string $endpoint
* @property \Illuminate\Support\Carbon|null $successful_at
* @property array $payload
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
*/
class Webhook extends Model
{
use HasFactory, MassPrunable;

View File

@ -9,6 +9,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
/**
* @property string $endpoint
* @property string $description
* @property array $events
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
*/
class WebhookConfiguration extends Model
{
use HasFactory, SoftDeletes;

View File

@ -15,9 +15,7 @@ class AccountCreated extends Notification implements ShouldQueue
/**
* Create a new notification instance.
*/
public function __construct(public User $user, public ?string $token = null)
{
}
public function __construct(public User $user, public ?string $token = null) {}
/**
* Get the notification's delivery channels.

View File

@ -8,9 +8,7 @@ use Illuminate\Notifications\Messages\MailMessage;
class MailTested extends Notification
{
public function __construct(private User $user)
{
}
public function __construct(private User $user) {}
public function via(): array
{

View File

@ -14,9 +14,7 @@ class SendPasswordReset extends Notification implements ShouldQueue
/**
* Create a new notification instance.
*/
public function __construct(public string $token)
{
}
public function __construct(public string $token) {}
/**
* Get the notification's delivery channels.

View File

@ -23,8 +23,7 @@ class ActivityLogService
protected ActivityLogBatchService $batch,
protected ActivityLogTargetableService $targetable,
protected ConnectionInterface $connection
) {
}
) {}
/**
* Sets the activity logger as having been caused by an anonymous

View File

@ -30,9 +30,7 @@ class AssignmentService
/**
* AssignmentService constructor.
*/
public function __construct(protected ConnectionInterface $connection)
{
}
public function __construct(protected ConnectionInterface $connection) {}
/**
* Insert allocations into the database and link them to a specific node.

View File

@ -13,9 +13,7 @@ class FindAssignableAllocationService
/**
* FindAssignableAllocationService constructor.
*/
public function __construct(private AssignmentService $service)
{
}
public function __construct(private AssignmentService $service) {}
/**
* Finds an existing unassigned allocation and attempts to assign it to the given server. If

View File

@ -19,8 +19,7 @@ class DeleteBackupService
private ConnectionInterface $connection,
private BackupManager $manager,
private DaemonBackupRepository $daemonBackupRepository
) {
}
) {}
/**
* Deletes a backup from the system. If the backup is stored in S3 a request

View File

@ -13,9 +13,7 @@ class DownloadLinkService
/**
* DownloadLinkService constructor.
*/
public function __construct(private BackupManager $backupManager, private NodeJWTService $jwtService)
{
}
public function __construct(private BackupManager $backupManager, private NodeJWTService $jwtService) {}
/**
* Returns the URL that allows for a backup to be downloaded by an individual

View File

@ -26,8 +26,7 @@ class InitiateBackupService
private DaemonBackupRepository $daemonBackupRepository,
private DeleteBackupService $deleteBackupService,
private BackupManager $backupManager
) {
}
) {}
/**
* Set if the backup should be locked once it is created which will prevent

View File

@ -32,8 +32,7 @@ class DatabaseManagementService
public function __construct(
protected ConnectionInterface $connection,
protected DynamicDatabaseConnection $dynamic,
) {
}
) {}
/**
* Generates a unique database name for the given server. This name should be passed through when

View File

@ -15,8 +15,7 @@ class DatabasePasswordService
public function __construct(
private ConnectionInterface $connection,
private DynamicDatabaseConnection $dynamic,
) {
}
) {}
/**
* Updates a password for a given database.

View File

@ -13,9 +13,7 @@ class DeployServerDatabaseService
/**
* DeployServerDatabaseService constructor.
*/
public function __construct(private DatabaseManagementService $managementService)
{
}
public function __construct(private DatabaseManagementService $managementService) {}
/**
* @throws \Throwable

View File

@ -16,8 +16,7 @@ class HostCreationService
private ConnectionInterface $connection,
private DatabaseManager $databaseManager,
private DynamicDatabaseConnection $dynamic,
) {
}
) {}
/**
* Create a new database host on the Panel.

View File

@ -16,8 +16,7 @@ class HostUpdateService
private ConnectionInterface $connection,
private DatabaseManager $databaseManager,
private DynamicDatabaseConnection $dynamic,
) {
}
) {}
/**
* Update a database host and persist to the database.

View File

@ -12,9 +12,7 @@ class EggConfigurationService
/**
* EggConfigurationService constructor.
*/
public function __construct(private ServerConfigurationStructureService $configurationStructureService)
{
}
public function __construct(private ServerConfigurationStructureService $configurationStructureService) {}
/**
* Return an Egg file to be used by the Daemon.

View File

@ -25,9 +25,7 @@ class EggImporterService
'server.build.environment.' => 'server.environment.',
];
public function __construct(protected ConnectionInterface $connection)
{
}
public function __construct(protected ConnectionInterface $connection) {}
/**
* Take an uploaded JSON file and parse it into a new egg.

View File

@ -14,9 +14,7 @@ class VariableCreationService
/**
* VariableCreationService constructor.
*/
public function __construct(private ValidationFactory $validator)
{
}
public function __construct(private ValidationFactory $validator) {}
/**
* Return the validation factory instance to be used by rule validation

View File

@ -15,9 +15,7 @@ class VariableUpdateService
/**
* VariableUpdateService constructor.
*/
public function __construct(private ValidationFactory $validator)
{
}
public function __construct(private ValidationFactory $validator) {}
/**
* Return the validation factory instance to be used by rule validation

View File

@ -14,8 +14,7 @@ class DeleteFilesService
*/
public function __construct(
private DaemonFileRepository $daemonFileRepository
) {
}
) {}
/**
* Deletes the given files.

View File

@ -15,8 +15,7 @@ class NodeAutoDeployService
*/
public function __construct(
private readonly KeyCreationService $keyCreationService
) {
}
) {}
/**
* Generates a new API key for the logged-in user with only permission to read

View File

@ -13,8 +13,7 @@ class NodeDeletionService
*/
public function __construct(
protected Translator $translator
) {
}
) {}
/**
* Delete a node from the panel if no servers are attached to it.

View File

@ -17,8 +17,7 @@ class NodeUpdateService
public function __construct(
private ConnectionInterface $connection,
private DaemonConfigurationRepository $configurationRepository,
) {
}
) {}
/**
* Update the configuration values for a given node on the machine.

View File

@ -16,9 +16,7 @@ class ProcessScheduleService
/**
* ProcessScheduleService constructor.
*/
public function __construct(private ConnectionInterface $connection, private Dispatcher $dispatcher, private DaemonServerRepository $serverRepository)
{
}
public function __construct(private ConnectionInterface $connection, private Dispatcher $dispatcher, private DaemonServerRepository $serverRepository) {}
/**
* Process a schedule and push the first task onto the queue worker.

View File

@ -19,8 +19,7 @@ class BuildModificationService
private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository,
private ServerConfigurationStructureService $structureService
) {
}
) {}
/**
* Change the build details for a specified server.

View File

@ -16,9 +16,7 @@ class DetailsModificationService
/**
* DetailsModificationService constructor.
*/
public function __construct(private ConnectionInterface $connection, private DaemonServerRepository $serverRepository)
{
}
public function __construct(private ConnectionInterface $connection, private DaemonServerRepository $serverRepository) {}
/**
* Update the details for a single server instance.

View File

@ -15,8 +15,7 @@ class ReinstallServerService
public function __construct(
private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository
) {
}
) {}
/**
* Reinstall a server on the remote daemon.

View File

@ -10,9 +10,7 @@ class ServerConfigurationStructureService
/**
* ServerConfigurationStructureService constructor.
*/
public function __construct(private EnvironmentService $environment)
{
}
public function __construct(private EnvironmentService $environment) {}
/**
* Return a configuration array for a specific server when passed a server model.

View File

@ -31,8 +31,7 @@ class ServerCreationService
private FindViableNodesService $findViableNodesService,
private ServerDeletionService $serverDeletionService,
private VariableValidatorService $validatorService
) {
}
) {}
/**
* Create a server on the Panel and trigger a request to the Daemon to begin the server

View File

@ -21,8 +21,7 @@ class ServerDeletionService
private ConnectionInterface $connection,
private DaemonServerRepository $daemonServerRepository,
private DatabaseManagementService $databaseManagementService
) {
}
) {}
/**
* Set if the server should be forcibly deleted from the panel (ignoring daemon errors) or not.

View File

@ -17,9 +17,7 @@ class StartupModificationService
/**
* StartupModificationService constructor.
*/
public function __construct(private ConnectionInterface $connection, private VariableValidatorService $validatorService)
{
}
public function __construct(private ConnectionInterface $connection, private VariableValidatorService $validatorService) {}
/**
* Process startup modification for a server.

View File

@ -20,8 +20,7 @@ class SuspensionService
*/
public function __construct(
private DaemonServerRepository $daemonServerRepository
) {
}
) {}
/**
* Suspends a server on the system.

View File

@ -22,8 +22,7 @@ class TransferServerService
public function __construct(
private ConnectionInterface $connection,
private NodeJWTService $nodeJWTService,
) {
}
) {}
private function notify(Server $server, Plain $token): void
{

View File

@ -16,9 +16,7 @@ class VariableValidatorService
/**
* VariableValidatorService constructor.
*/
public function __construct(private ValidationFactory $validator)
{
}
public function __construct(private ValidationFactory $validator) {}
/**
* Validate all of the passed data against the given egg variables.

View File

@ -20,8 +20,7 @@ class SubuserCreationService
public function __construct(
private ConnectionInterface $connection,
private UserCreationService $userCreationService,
) {
}
) {}
/**
* Creates a new user on the system and assigns them access to the provided server.

View File

@ -18,8 +18,7 @@ class ToggleTwoFactorService
public function __construct(
private ConnectionInterface $connection,
private Google2FA $google2FA,
) {
}
) {}
/**
* Toggle 2FA on an account only if the token provided is valid.

View File

@ -19,8 +19,7 @@ class UserCreationService
private ConnectionInterface $connection,
private Hasher $hasher,
private PasswordBroker $passwordBroker,
) {
}
) {}
/**
* Create a new user on the system.

View File

@ -13,9 +13,7 @@ class UserUpdateService
/**
* UserUpdateService constructor.
*/
public function __construct(private Hasher $hasher)
{
}
public function __construct(private Hasher $hasher) {}
/**
* Update the user model instance and return the updated model.

View File

@ -51,7 +51,5 @@ return Application::configure(basePath: dirname(__DIR__))
\Illuminate\Contracts\Console\Kernel::class => \App\Console\Kernel::class,
\Illuminate\Contracts\Debug\ExceptionHandler::class => \App\Exceptions\Handler::class,
])
->withExceptions(function (Exceptions $exceptions) {
})
->withExceptions(function (Exceptions $exceptions) {})
->create();

1409
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::table('permissions', function (Blueprint $table) {
});
Schema::table('permissions', function (Blueprint $table) {});
}
};

View File

@ -21,7 +21,5 @@ return new class extends Migration
/**
* Reverse the migrations.
*/
public function down(): void
{
}
public function down(): void {}
};

View File

@ -17,7 +17,5 @@ return new class extends Migration
/**
* Reverse the migrations.
*/
public function down(): void
{
}
public function down(): void {}
};

View File

@ -12,14 +12,14 @@ return new class extends Migration
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('servers_node_foreign');
$table->dropForeign('servers_owner_foreign');
$table->dropForeign('servers_allocation_foreign');
$table->dropForeign('servers_service_foreign');
$table->dropForeign('servers_option_foreign');
$table->dropForeign('servers_pack_foreign');
$table->dropForeign(['node']);
$table->dropForeign(['owner']);
$table->dropForeign(['allocation']);
$table->dropForeign(['service']);
$table->dropForeign(['option']);
$table->dropForeign(['pack']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropIndex('servers_node_foreign');
$table->dropIndex('servers_owner_foreign');
$table->dropIndex('servers_allocation_foreign');
@ -52,13 +52,11 @@ return new class extends Migration
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['node_id']);
$table->dropForeign(['owner_id']);
$table->dropForeign(['allocation_id']);
$table->dropForeign(['service_id']);
$table->dropForeign(['option_id']);
}
$table->dropForeign(['node_id']);
$table->dropForeign(['owner_id']);
$table->dropForeign(['allocation_id']);
$table->dropForeign(['service_id']);
$table->dropForeign(['option_id']);
$table->renameColumn('node_id', 'node');
$table->renameColumn('owner_id', 'owner');

View File

@ -12,8 +12,9 @@ return new class extends Migration
public function up(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign(['location']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('nodes_location_foreign');
$table->dropIndex('nodes_location_foreign');
}
@ -28,8 +29,9 @@ return new class extends Migration
public function down(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign(['location_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('nodes_location_id_foreign');
$table->dropIndex('nodes_location_id_foreign');
}

View File

@ -12,9 +12,10 @@ return new class extends Migration
public function up(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign(['node']);
$table->dropForeign(['assigned_to']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('allocations_node_foreign');
$table->dropForeign('allocations_assigned_to_foreign');
$table->dropIndex('allocations_node_foreign');
$table->dropIndex('allocations_assigned_to_foreign');
}
@ -32,9 +33,10 @@ return new class extends Migration
public function down(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign(['node_id']);
$table->dropForeign(['server_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('allocations_node_id_foreign');
$table->dropForeign('allocations_server_id_foreign');
$table->dropIndex('allocations_node_id_foreign');
$table->dropIndex('allocations_server_id_foreign');
}

View File

@ -12,8 +12,9 @@ return new class extends Migration
public function up(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['parent_service']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_options_parent_service_foreign');
$table->dropIndex('service_options_parent_service_foreign');
}
@ -28,8 +29,9 @@ return new class extends Migration
public function down(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['service_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_options_service_id_foreign');
$table->dropIndex('service_options_service_id_foreign');
}

View File

@ -12,8 +12,9 @@ return new class extends Migration
public function up(): void
{
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_packs_option_foreign');
$table->dropIndex('service_packs_option_foreign');
}
@ -28,8 +29,9 @@ return new class extends Migration
public function down(): void
{
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('service_packs_option_id_foreign');
$table->dropIndex('service_packs_option_id_foreign');
}

View File

@ -5,6 +5,7 @@ use App\Models\Permission;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
@ -26,10 +27,12 @@ return new class extends Migration
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropForeign(['server_id']);
$table->dropForeign(['user_id']);
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign('permissions_server_id_foreign');
$table->dropIndex('permissions_server_id_foreign');
$table->dropForeign('permissions_user_id_foreign');
$table->dropIndex('permissions_user_id_foreign');
}

View File

@ -12,9 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('node_configuration_tokens', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['node']);
}
$table->dropForeign(['node']);
$table->dropColumn('expires_at');
$table->renameColumn('node', 'node_id');
@ -29,9 +27,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('node_configuration_tokens', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['node_id']);
}
$table->dropForeign(['node_id']);
$table->renameColumn('node_id', 'node');
$table->timestamp('expires_at')->after('token');

View File

@ -11,11 +11,9 @@ return new class extends Migration
*/
public function up(): void
{
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
});
}
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
});
Schema::rename('service_packs', 'packs');
@ -29,11 +27,9 @@ return new class extends Migration
*/
public function down(): void
{
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
Schema::table('packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
});
}
Schema::table('packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
});
Schema::rename('packs', 'service_packs');

View File

@ -11,11 +11,9 @@ return new class extends Migration
*/
public function up(): void
{
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
Schema::table('database_servers', function (Blueprint $table) {
$table->dropForeign(['linked_node']);
});
}
Schema::table('database_servers', function (Blueprint $table) {
$table->dropForeign(['linked_node']);
});
Schema::rename('database_servers', 'database_hosts');
@ -31,11 +29,9 @@ return new class extends Migration
*/
public function down(): void
{
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
Schema::table('database_hosts', function (Blueprint $table) {
$table->dropForeign(['node_id']);
});
}
Schema::table('database_hosts', function (Blueprint $table) {
$table->dropForeign(['node_id']);
});
Schema::rename('database_hosts', 'database_servers');

View File

@ -12,9 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('databases', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['db_server']);
}
$table->dropForeign(['db_server']);
$table->renameColumn('db_server', 'database_host_id');
@ -28,9 +26,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('databases', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['database_host_id']);
}
$table->dropForeign(['database_host_id']);
$table->renameColumn('database_host_id', 'db_server');

View File

@ -13,9 +13,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('tasks', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['server']);
}
$table->dropForeign(['server']);
$table->renameColumn('server', 'server_id');
$table->unsignedInteger('user_id')->nullable()->after('id');
@ -38,10 +36,8 @@ return new class extends Migration
public function down(): void
{
Schema::table('tasks', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['server_id']);
$table->dropForeign(['user_id']);
}
$table->dropForeign(['server_id']);
$table->dropForeign(['user_id']);
$table->renameColumn('server_id', 'server');
$table->dropColumn('user_id');

View File

@ -12,9 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('api_permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['key_id']);
}
$table->dropForeign(['key_id']);
$table->foreign('key_id')->references('id')->on('api_keys')->onDelete('cascade');
});
@ -26,9 +24,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('api_permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['key_id']);
}
$table->dropForeign(['key_id']);
$table->foreign('key_id')->references('id')->on('api_keys');
});

View File

@ -12,18 +12,14 @@ return new class extends Migration
public function up(): void
{
Schema::table('permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['subuser_id']);
}
$table->dropForeign(['subuser_id']);
$table->foreign('subuser_id')->references('id')->on('subusers')->onDelete('cascade');
});
Schema::table('subusers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['user_id']);
$table->dropForeign(['server_id']);
}
$table->dropForeign(['user_id']);
$table->dropForeign(['server_id']);
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('server_id')->references('id')->on('servers')->onDelete('cascade');
@ -36,19 +32,15 @@ return new class extends Migration
public function down(): void
{
Schema::table('subusers', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['user_id']);
$table->dropForeign(['server_id']);
}
$table->dropForeign(['user_id']);
$table->dropForeign(['server_id']);
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('server_id')->references('id')->on('servers');
});
Schema::table('permissions', function (Blueprint $table) {
if (Schema::getConnection()->getDriverName() !== 'sqlite') {
$table->dropForeign(['subuser_id']);
}
$table->dropForeign(['subuser_id']);
$table->foreign('subuser_id')->references('id')->on('subusers');
});

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