Files
exchange-2.0/database/migrations/2020_12_02_131122_create_receipt_table.php
T
weiken.intex 4d8079c7a5 Receipt
2020-12-10 15:08:02 +08:00

63 lines
2.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateReceiptTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('receipt', function (Blueprint $table) {
$table->id();
$table->string('trans_type1');
$table->string('trans_type2');
$table->bigInteger('bill_no')->unsigned();
$table->decimal('amount', 14, 5)->default(0.00);
$table->decimal('original_amount', 14, 5)->default(0.00);
$table->bigInteger('currency_id')->unsigned();
$table->bigInteger('original_currency_id')->unsigned();
$table->decimal('currency_rate', 14, 5)->default(0.00);
$table->date('dt_transaction');
$table->integer('status');
$table->bigInteger('booking_id')->unsigned();
$table->bigInteger('company_id')->unsigned();
$table->timestamps();
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
$table->foreign('currency_id')->references('id')->on('currencies')->onDelete('cascade');
$table->foreign('original_currency_id')->references('id')->on('currencies')->onDelete('cascade');
});
Schema::create('receipt_detail', function (Blueprint $table) {
$table->id();
$table->string('trans_type1');
$table->string('trans_type2');
$table->bigInteger('receipt_id')->unsigned();
$table->bigInteger('transaction_id')->unsigned();
$table->decimal('price', 14, 5)->default(0.00);
$table->decimal('amount', 14, 5)->default(0.00);
$table->timestamps();
$table->foreign('receipt_id')->references('id')->on('receipt')->onDelete('cascade');
$table->foreign('transaction_id')->references('id')->on('transaction')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('receipt');
Schema::dropIfExists('receipt_detail');
}
}