MIELICIUS / database / migrations / 2023_01_12_053123_create_custvoices_table.php
2023_01_12_053123_create_custvoices_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('custvoices', function (Blueprint $table) {
            $table->id('idcustvoices');
            $table->bigInteger('idsqnya')->unsigned();
            $table->string('kodesq');
            $table->string('kodecust');
            $table->string('tglpembelian');
            $table->string('tglditerima');
            $table->string('total');
            $table->string('status');
            $table->timestamps();
        });

        Schema::table('custvoices', function (Blueprint $table) {
            $table->foreign('kodecust')->references('kodecustomer')->on('customers')->onUpdate('cascade')->onDelete('cascade');
        });
        Schema::table('custvoices', function (Blueprint $table) {
            $table->foreign('idsqnya')->references('idsq')->on('sales')->onUpdate('cascade')->onDelete('cascade');
        });
    }

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