Updated migrations

This commit is contained in:
2025-03-15 20:05:27 +01:00
parent e9b18c94fc
commit e653fbf5fa
8 changed files with 52 additions and 13 deletions
@@ -13,9 +13,9 @@ return new class extends Migration
{
Schema::create('filament_types', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name');
$table->string('description');
$table->timestamps();
});
}
@@ -13,7 +13,6 @@ return new class extends Migration
{
Schema::create('filaments', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->required();
$table->string('description')->nullable();
$table->string('color_id')->required();
@@ -29,6 +28,7 @@ return new class extends Migration
$table->integer('temp_max')->nullable();
$table->integer('buildplate_id')->nullable();
$table->integer('extruder_id')->nullable();
$table->timestamps();
});
}
@@ -13,9 +13,9 @@ return new class extends Migration
{
Schema::create('colors', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->required();
$table->string('hex')->required();
$table->timestamps();
});
}
@@ -13,12 +13,12 @@ return new class extends Migration
{
Schema::create('manufacturers', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->required();
$table->string('description')->nullable();
$table->string('website')->nullable();
$table->string('logo')->nullable();
$table->integer('filament_count')->default(0);
$table->timestamps();
});
}
@@ -0,0 +1,32 @@
<?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('extruders', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->string('manufacturer_id')->required();
$table->string('diameter')->required();
$table->string('temp_max')->required();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('extruders');
}
};
@@ -11,9 +11,13 @@ return new class extends Migration
*/
public function up(): void
{
Schema::table('manufacturers', function (Blueprint $table) {
//
$table->integer('filament_count')->default(0);
Schema::create('buildplates', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description');
$table->foreignId('manufacturer_id')->constrained();
$table->string('temp_max');
$table->timestamps();
});
}
@@ -22,9 +26,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::table('manufacturers', function (Blueprint $table) {
//
$table->dropColumn('filament_count');
});
Schema::dropIfExists('buildplates');
}
};
+7
View File
@@ -16,6 +16,13 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
User::factory(10)->create();
User::create([
'name' => 'Admin',
'email' => 'admin@local',
'password' => bcrypt('password')
]);
$this ->call(
ColorSeeder::class,
ManufacturerSeeder::class