<?php

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

class CreatePeriodiksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_periodik', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('tinggi_badan');
            $table->integer('berat_badan');
            $table->integer('jarak_kesekolah');
            $table->integer('waktu_tempuh');
            $table->integer('jumlah_saudara');
            $table->integer('id_pendaftar')->unsigned()->default(0);
            $table->foreign('id_pendaftar')
                  ->references('id')->on('t_pendaftar')
                  ->onDelete('cascade');
            $table->timestamps();
        });
    }

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