MINI Sh3ll
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCompanyUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('company_users', function (Blueprint $table) {
$table->unsignedInteger('user_id')->nullable();
$table->unsignedInteger('company_id')->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('company_users', function (Blueprint $table) {
$table->dropForeign('company_users_user_id_foreign');
$table->dropForeign('company_users_company_id_foreign');
$table->dropColumn('user_id');
$table->dropColumn('company_id');
});
}
}
OHA YOOOO