43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
|
|
use App\Enums\Concentration;
|
|
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('perfumes', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('brand_id')->nullable()->constrained()->cascadeOnDelete();
|
|
$table->string('name', 50);
|
|
$table->string('slug', 70)->unique();
|
|
$table->string('sku', 20)->unique();
|
|
$table->enum('concentration', Concentration::values())->default(Concentration::EXTRAIT_DE_PERFUME)->comment(Concentration::comment());
|
|
$table->unsignedInteger('cost_price')->default(0);
|
|
$table->unsignedInteger('sale_price')->default(0);
|
|
$table->string('base_notes')->nullable();
|
|
$table->string('middle_notes')->nullable();
|
|
$table->string('top_notes')->nullable();
|
|
$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('perfumes');
|
|
}
|
|
};
|