Lager-v3/database/migrations/2022_08_22_092858_create_ca...

40 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2022-09-28 07:38:08 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cabels', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->unsignedBigInteger('cabel_category_id');
$table->unsignedBigInteger('total');
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
$table->timestamp('deleted_at')->nullable();
$table->foreign('cabel_category_id')->references('id')->on('cabel_categories')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cabels');
}
};