MIELICIUS / database / migrations / 2023_01_12_081357_create_vendbills_table.php
2023_01_12_081357_create_vendbills_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('vendbills', function (Blueprint $table) {
            $table->id('idvendbills');
            $table->bigInteger('idrfqnya')->unsigned();
            $table->string('koderfq');
            $table->string('kodevend');
            $table->string('tglpembelian');
            $table->string('tglditerima');
            $table->string('total');
            $table->string('status');
            $table->timestamps();
        });

        Schema::table('vendbills', function (Blueprint $table) {
            $table->foreign('kodevend')->references('kodevendor')->on('vendors')->onUpdate('cascade')->onDelete('cascade');
        });
        Schema::table('vendbills', function (Blueprint $table) {
            $table->foreign('idrfqnya')->references('idrfq')->on('rfqs')->onUpdate('cascade')->onDelete('cascade');
        });
    }

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