45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?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('recipes', function (Blueprint $table) {
|
||
|
|
$table->id();
|
||
|
|
$table->string('title');
|
||
|
|
$table->string('slug')->unique();
|
||
|
|
$table->text('description')->nullable();
|
||
|
|
$table->integer('prep_time')->nullable()->comment('Minutes');
|
||
|
|
$table->integer('cook_time')->nullable()->comment('Minutes');
|
||
|
|
$table->integer('total_time')->nullable()->comment('Minutes');
|
||
|
|
$table->integer('servings')->nullable();
|
||
|
|
$table->string('difficulty')->nullable();
|
||
|
|
$table->string('cuisine')->nullable();
|
||
|
|
$table->string('category')->nullable();
|
||
|
|
$table->integer('calories')->nullable();
|
||
|
|
$table->string('featured_image')->nullable();
|
||
|
|
$table->string('video_url')->nullable();
|
||
|
|
$table->tinyInteger('status')->default(0)->comment('0=draft, 1=published');
|
||
|
|
$table->unsignedBigInteger('views_count')->default(0);
|
||
|
|
$table->decimal('rating_avg', 3, 2)->nullable();
|
||
|
|
$table->unsignedInteger('rating_count')->default(0);
|
||
|
|
$table->timestamps();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Reverse the migrations.
|
||
|
|
*/
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('recipes');
|
||
|
|
}
|
||
|
|
};
|