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