MINI Sh3ll
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEnquiriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('enquiries', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('created_by')->nullable();
$table->unsignedInteger('plant_id')->nullable();
$table->unsignedInteger('company_id')->nullable();
$table->string('contact_name')->nullable();
$table->string('email')->nullable();
$table->string('mobile', 10)->nullable();
$table->unsignedInteger('country_id')->nullable();
$table->Integer('product_type')->nullable();
$table->string('site_locator')->nullable();
$table->string('date_code')->nullable();
$table->string('serial_number')->nullable();
$table->Integer('issue_type')->nullable();
$table->string('description',1000)->nullable();
$table->tinyInteger('status')->default(0)->nullable();
$table->unsignedInteger('updated_by')->nullable();
$table->Integer('ticket_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreign('updated_by')->references('id')->on('users')->onDelete('cascade');
$table->foreign('created_by')->references('id')->on('users')->onDelete('cascade');
$table->foreign('plant_id')->references('id')->on('plants')->onDelete('cascade');
$table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('enquiries', function (Blueprint $table) {
$table->dropForeign('enquiries_company_id_foreign');
$table->dropColumn('company_id');
$table->dropForeign('enquiries_country_id_foreign');
$table->dropColumn('country_id');
$table->dropForeign('enquiries_plant_id_foreign');
$table->dropColumn('plant_id');
$table->dropForeign('enquiries_created_by_foreign');
$table->dropColumn('created_by');
$table->dropForeign('enquiries_updated_by_foreign');
$table->dropColumn('updated_by');
});
Schema::dropIfExists('enquiries');
}
}
OHA YOOOO