mein-sterntours/database/migrations/2018_10_29_202123_create_booking_table.php
2018-11-17 02:03:59 +01:00

99 lines
4.6 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
/**
* Migration auto-generated by Sequel Pro Laravel Export (1.4.1)
* @see https://github.com/cviebrock/sequel-pro-laravel-export
*/
class CreateBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('booking', function (Blueprint $table) {
$table->bigIncrements('id');
$table->date('booking_date')->nullable();
$table->bigInteger('customer_id');
$table->bigInteger('lead_id')->nullable();
$table->tinyInteger('new_drafts')->nullable();
$table->integer('sf_guard_user_id');
$table->bigInteger('branch_id');
$table->decimal('service_fee', 10, 2)->nullable()->default(0.00);
$table->bigInteger('travel_country_id')->nullable();
$table->bigInteger('travel_category_id')->nullable();
$table->bigInteger('pax')->nullable();
$table->bigInteger('coupon_id')->nullable();
$table->dateTime('created_at');
$table->dateTime('updated_at');
$table->string('title', 255)->nullable();
$table->date('start_date')->nullable();
$table->date('end_date')->nullable();
$table->bigInteger('website_id')->nullable();
$table->string('travel_number', 30)->nullable();
$table->string('participant_name', 80)->nullable();
$table->string('participant_firstname', 80)->nullable();
$table->date('participant_birthdate')->nullable();
$table->bigInteger('participant_salutation_id')->nullable();
$table->string('ev_number', 255)->nullable();
$table->string('merlin_knr', 255)->nullable();
$table->string('merlin_order_number', 255)->nullable();
$table->bigInteger('travel_company_id')->nullable();
$table->decimal('price', 10, 2)->nullable();
$table->decimal('price_total', 10, 2)->nullable();
$table->decimal('deposit_total', 10, 2)->nullable();
$table->decimal('final_payment', 10, 2)->nullable();
$table->date('final_payment_date')->nullable();
$table->bigInteger('travelagenda_id')->nullable();
$table->index('lead_id', 'lead_id_idx');
$table->index('sf_guard_user_id', 'sf_guard_user_id_idx');
$table->index('branch_id', 'branch_id_idx');
$table->index('customer_id', 'customer_id_idx');
$table->index('coupon_id', 'coupon_id_idx');
$table->index('travel_category_id', 'travel_category_id_idx');
$table->index('travel_country_id', 'travel_country_id_idx');
$table->index('travel_company_id', 'booking_travel_company_id_idx');
$table->index('travelagenda_id', 'booking_travelagenda_id_idx');
$table->foreign('branch_id', 'booking_branch_id_branch_id')->references('id')->on('branch')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('coupon_id', 'booking_coupon_id_coupon_id')->references('id')->on('coupon')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('customer_id', 'booking_customer_id_customer_id')->references('id')->on('customer')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('lead_id', 'booking_lead_id_lead_id')->references('id')->on('lead')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('sf_guard_user_id', 'booking_sf_guard_user_id_sf_guard_user_id')->references('id')->on('sf_guard_user')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('travel_category_id', 'booking_travel_category_id_travel_category_id')->references('id')->on('travel_category')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('travel_company_id', 'booking_travel_company_id_travel_company_id')->references('id')->on('travel_company')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('travel_country_id', 'booking_travel_country_id_travel_country_id')->references('id')->on('travel_country')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
$table->foreign('travelagenda_id', 'booking_travelagenda_id_travel_agenda_id')->references('id')->on('travel_agenda')->onDelete('RESTRICT
')->onUpdate('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('booking');
}
}