diff --git a/app/Http/Controllers/Api/ActivityController.php b/app/Http/Controllers/Api/ActivityController.php index 4424063..22eb6f8 100644 --- a/app/Http/Controllers/Api/ActivityController.php +++ b/app/Http/Controllers/Api/ActivityController.php @@ -58,7 +58,7 @@ class ActivityController extends Controller 'start_at' => ['nullable', 'date'], 'end_at' => ['nullable', 'date'], 'address' => ['nullable', 'string', 'max:255'], - 'contact_phone' => ['nullable', 'string', 'max:64'], + 'contact_phone' => ['nullable', 'string', 'max:255'], 'lat' => ['nullable', 'numeric'], 'lng' => ['nullable', 'numeric'], 'detail_html' => ['nullable', 'string'], @@ -113,7 +113,7 @@ class ActivityController extends Controller 'start_at' => ['nullable', 'date'], 'end_at' => ['nullable', 'date'], 'address' => ['nullable', 'string', 'max:255'], - 'contact_phone' => ['nullable', 'string', 'max:64'], + 'contact_phone' => ['nullable', 'string', 'max:255'], 'lat' => ['nullable', 'numeric'], 'lng' => ['nullable', 'numeric'], 'detail_html' => ['nullable', 'string'], diff --git a/app/Http/Controllers/Api/VenueController.php b/app/Http/Controllers/Api/VenueController.php index 3fbc0ad..e1b7128 100644 --- a/app/Http/Controllers/Api/VenueController.php +++ b/app/Http/Controllers/Api/VenueController.php @@ -34,7 +34,7 @@ class VenueController extends Controller 'visit_form' => ['nullable', 'string'], 'consultation_hours' => ['nullable', 'string'], 'address' => ['nullable', 'string', 'max:255'], - 'contact_phone' => ['nullable', 'string', 'max:64'], + 'contact_phone' => ['nullable', 'string', 'max:255'], 'lat' => ['nullable', 'numeric'], 'lng' => ['nullable', 'numeric'], 'cover_image' => ['nullable', 'string', 'max:255'], @@ -146,7 +146,7 @@ class VenueController extends Controller 'visit_form' => ['nullable', 'string'], 'consultation_hours' => ['nullable', 'string'], 'address' => ['nullable', 'string', 'max:255'], - 'contact_phone' => ['nullable', 'string', 'max:64'], + 'contact_phone' => ['nullable', 'string', 'max:255'], 'lat' => ['nullable', 'numeric'], 'lng' => ['nullable', 'numeric'], 'cover_image' => ['nullable', 'string', 'max:255'], diff --git a/app/Services/VenueImportService.php b/app/Services/VenueImportService.php index 46b47d7..6a0cd25 100644 --- a/app/Services/VenueImportService.php +++ b/app/Services/VenueImportService.php @@ -308,7 +308,7 @@ class VenueImportService 'detail_html' => ['nullable', 'string'], 'reservation_notice' => ['nullable', 'string'], 'address' => ['nullable', 'string', 'max:255'], - 'contact_phone' => ['nullable', 'string', 'max:64'], + 'contact_phone' => ['nullable', 'string', 'max:255'], 'lat' => ['nullable', 'numeric'], 'lng' => ['nullable', 'numeric'], 'sort' => ['nullable', 'integer', 'min:0'], diff --git a/database/migrations/2026_04_23_120000_widen_contact_phone_to_255.php b/database/migrations/2026_04_23_120000_widen_contact_phone_to_255.php new file mode 100644 index 0000000..78a8af9 --- /dev/null +++ b/database/migrations/2026_04_23_120000_widen_contact_phone_to_255.php @@ -0,0 +1,50 @@ +getDriverName(); + + if ($driver === 'mysql') { + DB::statement('ALTER TABLE `venues` MODIFY `contact_phone` VARCHAR(255) NULL'); + DB::statement('ALTER TABLE `activities` MODIFY `contact_phone` VARCHAR(255) NULL'); + + return; + } + + if ($driver === 'pgsql') { + DB::statement('ALTER TABLE venues ALTER COLUMN contact_phone TYPE VARCHAR(255)'); + DB::statement('ALTER TABLE activities ALTER COLUMN contact_phone TYPE VARCHAR(255)'); + } + } + + public function down(): void + { + if (! Schema::hasColumn('venues', 'contact_phone') || ! Schema::hasColumn('activities', 'contact_phone')) { + return; + } + + $driver = Schema::getConnection()->getDriverName(); + + if ($driver === 'mysql') { + DB::statement('ALTER TABLE `venues` MODIFY `contact_phone` VARCHAR(64) NULL'); + DB::statement('ALTER TABLE `activities` MODIFY `contact_phone` VARCHAR(64) NULL'); + + return; + } + + if ($driver === 'pgsql') { + DB::statement('ALTER TABLE venues ALTER COLUMN contact_phone TYPE VARCHAR(64)'); + DB::statement('ALTER TABLE activities ALTER COLUMN contact_phone TYPE VARCHAR(64)'); + } + } +};