MIELICIUS / database / migrations / 2023_01_11_175720_create_rfqisis_table.php
2023_01_11_175720_create_rfqisis_table.php
Raw
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('rfqisis', function (Blueprint $table) {
            $table->id('idrfqisi');
            $table->bigInteger('idrfqnya')->unsigned();
            $table->string('kodebah');
            $table->float('banyakqty');
            $table->bigInteger('hargaakhir');
            $table->timestamps();
        });
        Schema::table('rfqisis', function (Blueprint $table) {
            $table->foreign('idrfqnya')->references('idrfq')->on('rfqs')->onUpdate('cascade')->onDelete('cascade');
        });
        Schema::table('rfqisis', function (Blueprint $table) {
            $table->foreign('kodebah')->references('kodebahan')->on('bahans')->onUpdate('cascade')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('rfqisis');
    }
};