MINI Sh3ll
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCompaniesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('companies', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name')->nullable();
$table->unsignedInteger('country_id')->nullable();
$table->unsignedInteger('state')->nullable();
$table->string('city')->nullable();
$table->text('address')->nullable();
$table->tinyInteger('status')->default(1)->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
$table->foreign('state')->references('id')->on('states')->onDelete('cascade');
});
DB::update("ALTER TABLE companies AUTO_INCREMENT = 150;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('companies', function (Blueprint $table) {
$table->dropForeign('companies_country_id_foreign');
$table->dropColumn('country_id');
});
}
}
OHA YOOOO