fadlyshafa

Untitled

Mar 5th, 2020
1,090
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2.  
  3. use Illuminate\Support\Facades\Schema;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Database\Migrations\Migration;
  6.  
  7. class CreateTableProduk extends Migration
  8. {
  9.     /**
  10.      * Run the migrations.
  11.      *
  12.      * @return void
  13.      */
  14.     public function up()
  15.     {
  16.         Schema::create('m_produk', function (Blueprint $table) {
  17.             $table->increments('id');
  18.             $table->integer('supplier')->unsigned();
  19.             $table->string('nama',255);
  20.             $table->string('kode',40);
  21.             $table->integer('stock');
  22.             $table->integer('minimal_stock');
  23.             $table->integer('harga');
  24.             $table->timestamps();
  25.  
  26.             $table->foreign('supplier')->references('id')->on('m_supplier')->onDelete('restrict');
  27.             $table->engine = 'InnoDB';
  28.         });
  29.     }
  30.  
  31.     /**
  32.      * Reverse the migrations.
  33.      *
  34.      * @return void
  35.      */
  36.     public function down()
  37.     {
  38.         Schema::table('m_produk', function (Blueprint $table) {
  39.             //
  40.         });
  41.     }
  42. }
Add Comment
Please, Sign In to add comment