<?php

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

class CreatePendaftaranTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_pendaftar', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned()->index();
            $table->foreign('user_id')
                  ->references('id')->on('users')
                  ->onDelete('cascade');
            $table->integer('thnajaran_id')->unsigned()->index();
            $table->foreign('thnajaran_id')
                  ->references('id')->on('t_tahunajaran')
                  ->onDelete('cascade')->nullable();
            $table->string('no_pendaftar')->index();
            $table->string('nama');
            $table->string('jeniskelamin');
            $table->string('tempatlahir');
            $table->date('tanggallahir');
            $table->string('agama');
            $table->string('alamat');
            $table->string('kebutuhan_khusus');
            $table->string('no_tlp_rumah');
            $table->string('status')->nullable();
            $table->softDeletes();  
            $table->timestamps();
        });
    }

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