parfum/database/migrations/2025_10_02_020223_create_bottles_table.php

37 lines
1.0 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('bottles', function (Blueprint $table) {
$table->id();
$table->string('name', 50);
$table->string('slug', 70)->unique();
$table->unsignedInteger('size');
$table->unsignedInteger('cost_price')->default(0);
$table->unsignedInteger('sale_price')->default(0);
$table->text('description')->nullable();
$table->unsignedInteger('views')->default(0);
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('bottles');
}
};