56 lines
1.6 KiB
PHP
56 lines
1.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 CreateCouponTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('coupon', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
$table->string('number', 30)->nullable();
|
|
$table->bigInteger('customer_id');
|
|
$table->bigInteger('booking_id');
|
|
$table->decimal('value', 10, 2)->default(0.00);
|
|
$table->date('issue_date');
|
|
$table->date('valid_date');
|
|
$table->tinyInteger('is_redeemed')->default(0);
|
|
$table->date('redeem_date')->nullable();
|
|
$table->dateTime('created_at');
|
|
$table->dateTime('updated_at');
|
|
|
|
$table->index('customer_id', 'customer_id_idx');
|
|
$table->index('booking_id', 'booking_id_idx');
|
|
|
|
$table->foreign('booking_id', 'coupon_booking_id_booking_id')->references('id')->on('booking')->onDelete('RESTRICT
|
|
')->onUpdate('RESTRICT');
|
|
$table->foreign('customer_id', 'coupon_customer_id_customer_id')->references('id')->on('customer')->onDelete('RESTRICT
|
|
')->onUpdate('RESTRICT');
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('coupon');
|
|
}
|
|
}
|