Files
FilamentLaravel/database/migrations/2025_03_10_183058_create_filaments.php
T

44 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('filaments', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
// Foreign keys pointing to existing tables with non-standard names
$table->foreignId('color_id')->constrained('colors')->onUpdate('cascade')->onDelete('cascade');
$table->foreignId('manufacturer_id')->constrained('manufacturers')->onUpdate('cascade')->onDelete('cascade');
$table->foreignId('filament_type_id')->constrained('filament_types')->onUpdate('cascade')->onDelete('cascade');
$table->integer('weight');
$table->decimal('diameter', 10, 2);
$table->decimal('price', 10, 2)->nullable();
$table->string('finish')->nullable();
$table->string('image')->nullable();
$table->integer('stock')->default(0);
$table->integer('temp_min')->nullable();
$table->integer('temp_max')->nullable();
$table->integer('buildplate_id')->nullable();
$table->integer('extruder_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('filaments');
}
};