File: /var/www/html/dashboard.orbiwheels.com/database/migrations/2025_09_26_105206_create_trips_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('trips', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('booking_id')->nullable();
$table->unsignedBigInteger('transporter_id')->nullable();
$table->unsignedBigInteger('vehicle_type_id')->nullable();
$table->string('ride_type')->nullable();
$table->smallInteger('booking_type')->nullable();
$table->json('dates')->nullable();
$table->json('times')->nullable();
$table->json('locations')->nullable();
$table->json('pricing_details')->nullable();
$table->decimal('distance_km', 10, 2)->nullable();
$table->smallInteger('status')->default(0);
$table->timestamps();
});
Schema::table('booking_rides', function (Blueprint $table) {
$table->unsignedBigInteger('trip_id')->nullable()->after('booking_id');
});
Schema::table('bookings', function (Blueprint $table) {
$table->boolean('is_draft')->default(false)->after('status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('booking_rides', function (Blueprint $table) {
$table->dropColumn('trip_id');
});
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn('is_draft');
});
Schema::dropIfExists('trips');
}
};