From 108c790cf4ebb118171e4c793997d98418e591e7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 30 May 2023 09:52:58 +0200 Subject: [PATCH] rename schemalessAttrributes --- app/Http/Livewire/Project/Application/Deploy.php | 2 +- app/Http/Livewire/Project/Application/Rollback.php | 2 +- app/Jobs/ApplicationDeploymentJob.php | 6 +++--- app/Models/ApplicationDeploymentQueue.php | 6 +++--- bootstrap/helpers/applications.php | 12 ++++++------ .../2023_03_27_081716_create_applications_table.php | 2 +- ...26_create_application_deployment_queues_table.php | 2 +- .../project/application/deployments.blade.php | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/Http/Livewire/Project/Application/Deploy.php b/app/Http/Livewire/Project/Application/Deploy.php index 68c0a343e..2ccc9a9b3 100644 --- a/app/Http/Livewire/Project/Application/Deploy.php +++ b/app/Http/Livewire/Project/Application/Deploy.php @@ -38,7 +38,7 @@ class Deploy extends Component queue_application_deployment( application: $this->application, - metadata: [ + extra_attributes: [ 'deployment_uuid' => $this->deployment_uuid, 'application_uuid' => $this->application->uuid, 'force_rebuild' => $force, diff --git a/app/Http/Livewire/Project/Application/Rollback.php b/app/Http/Livewire/Project/Application/Rollback.php index 853e0f9cf..072784074 100644 --- a/app/Http/Livewire/Project/Application/Rollback.php +++ b/app/Http/Livewire/Project/Application/Rollback.php @@ -24,7 +24,7 @@ class Rollback extends Component queue_application_deployment( application: $this->application, - metadata: [ + extra_attributes: [ 'deployment_uuid' => $deployment_uuid, 'application_uuid' => $this->application->uuid, 'force_rebuild' => false, diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index bef5a7cee..ecb2769b8 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -229,9 +229,9 @@ COPY --from={$this->application->uuid}:{$this->git_commit}-build /app/{$this->ap if ($next_found) { dispatch(new ApplicationDeploymentJob( application_deployment_queue_id: $next_found->id, - deployment_uuid: $next_found->metadata['deployment_uuid'], - application_uuid: $next_found->metadata['application_uuid'], - force_rebuild: $next_found->metadata['force_rebuild'], + deployment_uuid: $next_found->extra_attributes['deployment_uuid'], + application_uuid: $next_found->extra_attributes['application_uuid'], + force_rebuild: $next_found->extra_attributes['force_rebuild'], )); } } diff --git a/app/Models/ApplicationDeploymentQueue.php b/app/Models/ApplicationDeploymentQueue.php index bc4d756eb..1b492f42b 100644 --- a/app/Models/ApplicationDeploymentQueue.php +++ b/app/Models/ApplicationDeploymentQueue.php @@ -11,14 +11,14 @@ class ApplicationDeploymentQueue extends Model protected $fillable = [ 'application_id', 'status', - 'metadata', + 'extra_attributes', ]; public $casts = [ - 'metadata' => SchemalessAttributes::class, + 'extra_attributes' => SchemalessAttributes::class, ]; public function scopeWithExtraAttributes(): Builder { - return $this->metadata->modelScope(); + return $this->extra_attributes->modelScope(); } } diff --git a/bootstrap/helpers/applications.php b/bootstrap/helpers/applications.php index 72172a6db..1a2043773 100644 --- a/bootstrap/helpers/applications.php +++ b/bootstrap/helpers/applications.php @@ -4,11 +4,11 @@ use App\Jobs\ApplicationDeploymentJob; use App\Models\Application; use App\Models\ApplicationDeploymentQueue; -function queue_application_deployment(Application $application, $metadata) +function queue_application_deployment(Application $application, $extra_attributes) { $deployment = ApplicationDeploymentQueue::create([ 'application_id' => $application->id, - 'metadata' => $metadata, + 'extra_attributes' => $extra_attributes, ]); $queued_deployments = ApplicationDeploymentQueue::where('application_id', $application->id)->where('status', 'queued')->get()->sortByDesc('created_at'); $running_deployments = ApplicationDeploymentQueue::where('application_id', $application->id)->where('status', 'in_progress')->get()->sortByDesc('created_at'); @@ -24,9 +24,9 @@ function queue_application_deployment(Application $application, $metadata) } dispatch(new ApplicationDeploymentJob( application_deployment_queue_id: $deployment->id, - deployment_uuid: $metadata['deployment_uuid'], - application_uuid: $metadata['application_uuid'], - force_rebuild: $metadata['force_rebuild'], - commit: $metadata['commit'] ?? null, + deployment_uuid: $extra_attributes['deployment_uuid'], + application_uuid: $extra_attributes['application_uuid'], + force_rebuild: $extra_attributes['force_rebuild'], + commit: $extra_attributes['commit'] ?? null, )); } diff --git a/database/migrations/2023_03_27_081716_create_applications_table.php b/database/migrations/2023_03_27_081716_create_applications_table.php index e2116a437..bad0343d5 100644 --- a/database/migrations/2023_03_27_081716_create_applications_table.php +++ b/database/migrations/2023_03_27_081716_create_applications_table.php @@ -41,7 +41,7 @@ return new class extends Migration $table->string('base_directory')->default('/'); $table->string('publish_directory')->nullable(); - $table->schemalessAttributes('previews'); + $table->schemalessAttributes('extra_attributes'); $table->string('health_check_path')->default('/'); $table->string('health_check_port')->nullable(); diff --git a/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php b/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php index 47796c02b..f5d9d2cbc 100644 --- a/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php +++ b/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php @@ -15,7 +15,7 @@ return new class extends Migration $table->id(); $table->string('application_id'); $table->integer('pull_request_id')->default(0); - $table->schemalessAttributes('metadata'); + $table->schemalessAttributes('extra_attributes'); $table->string('status')->default('queued'); $table->timestamps(); }); diff --git a/resources/views/livewire/project/application/deployments.blade.php b/resources/views/livewire/project/application/deployments.blade.php index d99f9a841..bf1131cdf 100644 --- a/resources/views/livewire/project/application/deployments.blade.php +++ b/resources/views/livewire/project/application/deployments.blade.php @@ -13,7 +13,7 @@ 'border-error hover:bg-error' => $deployment->status === 'error', 'border-success hover:bg-success' => $deployment->status === 'finished', ]) @if ($deployment->status !== 'cancelled by system' && $deployment->status !== 'queued') - href="{{ $current_url . '/' . $deployment->metadata['deployment_uuid'] }}" + href="{{ $current_url . '/' . $deployment->extra_attributes['deployment_uuid'] }}" @endif class="hover:no-underline">