From 0a37fd2d913865fe171f99a47c426fe3a0d33573 Mon Sep 17 00:00:00 2001 From: guillaume91 Date: Tue, 21 May 2024 16:26:05 +0200 Subject: [PATCH] [migration] add column harvest_json_path --- .../app/Livewire/Projects/ProjectManager.php | 3 +- laravel_app/app/Rules/HarvestFile.php | 19 +++++++++++++ ...105_add_harvest_data_in_projects_table.php | 28 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 laravel_app/app/Rules/HarvestFile.php create mode 100644 laravel_app/database/migrations/2024_05_21_133105_add_harvest_data_in_projects_table.php diff --git a/laravel_app/app/Livewire/Projects/ProjectManager.php b/laravel_app/app/Livewire/Projects/ProjectManager.php index cc5d322..ffeaf76 100644 --- a/laravel_app/app/Livewire/Projects/ProjectManager.php +++ b/laravel_app/app/Livewire/Projects/ProjectManager.php @@ -61,10 +61,11 @@ private function loadFormData(Project $project) { $this->formData = $project->toArray(); $this->pivot_json_path = $this->formData['pivot_json_path']; - $this->formData['pivot_json_path'] = null; $this->span_json_path = $this->formData['span_json_path']; $this->harvest_json_path = $this->formData['harvest_json_path']; + $this->formData['pivot_json_path'] = null; $this->formData['span_json_path'] = null; + $this->formData['harvest_json_path'] = null; $this->formData['boundingBoxes'] = $project->boundingBoxes->toArray(); $this->formData['mail_recipients'] = $project->emailRecipients->toArray() ?: [ [ diff --git a/laravel_app/app/Rules/HarvestFile.php b/laravel_app/app/Rules/HarvestFile.php new file mode 100644 index 0000000..7b35310 --- /dev/null +++ b/laravel_app/app/Rules/HarvestFile.php @@ -0,0 +1,19 @@ +string('harvest_json_path')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('projects', function (Blueprint $table) { + $table->dropColumn('harvest_json_path'); + }); + } +};