master
lion 6 days ago
parent 35d7698601
commit 3f47b8b537

@ -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'],

@ -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'],

@ -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'],

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): 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(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)');
}
}
};
Loading…
Cancel
Save