Files
ilycats/database/migrations/2026_01_22_004004_create_foods_table.php
2026-02-08 15:16:35 +07:00

35 lines
860 B
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
{
// Pastikan ini 'foods' (jamak), bukan 'food'
Schema::create('foods', function (Blueprint $table) {
$table->id();
$table->string('nama_makanan');
$table->string('slug')->unique()->nullable();
$table->integer('qty');
$table->string('unit');
$table->foreignId('category_id')->nullable()->constrained('categories')->onDelete('set null');
$table->string('kategori')->default('Umum');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('foods');
}
};