MIELICIUS / database / migrations / 2023_01_10_180359_create_salesisis_table.php
2023_01_10_180359_create_salesisis_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('salesisis', function (Blueprint $table) {
            $table->id('idsisi');
            $table->bigInteger('idsqnya')->unsigned();
            $table->bigInteger('idprod')->unsigned();
            $table->string('kodeprod');
            $table->float('banyakqty');
            $table->Integer('statbol');
            $table->string('statusproduk');
            $table->timestamps();
        });
        Schema::table('salesisis', function (Blueprint $table) {
            $table->foreign('idsqnya')->references('idsq')->on('sales')->onUpdate('cascade')->onDelete('cascade');
        });
        Schema::table('salesisis', function (Blueprint $table) {
            $table->foreign('idprod')->references('idproduk')->on('produks')->onUpdate('cascade')->onDelete('cascade');
        });
    }

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