pianello-api/database/migrations/2023_10_31_164631_create_routes_table.php

39 lines
1 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('routes', function (Blueprint $table) {
$table->id();
$table->string('name_it');
$table->string('name_en');
$table->text('description_it')->nullable();
$table->text('description_en')->nullable();
// sport type defined in pivot table
// pics defined in pivot table - first pic is the cover
$table->unsignedBigInteger('route_category_id');
$table->foreign('route_category_id')->references('id')->on('categories')->onDelete('cascade');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('routes');
}
};