<?php
/*
add InnoDB line to both, the current migration table and the target migration table
*/
public function up()
{
Schema::create('registrations', function (Blueprint $table) {
$table->engine = "InnoDB"; // engine handles foreign key constraints
// $table->BigIncrements('id'); // shit breaks cascade down function, what a headache, needs to be "increments"
$table->increments('id');
$table->integer('user_id')->unsigned()->nullable() ;
// $table->string('key_num'); // migrated to users table
$table->dateTime('event_date') ;
$table->timestamps();
});
// ON DELETE USER, DELETE ALL REGISTRATIONS THAT BELONG TO THIS USER
Schema::table('registrations', function (Blueprint $table) {
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade');
});
}