20-02-2026

This commit is contained in:
Kevin Adametz 2026-02-20 17:57:50 +01:00
parent 854ce02bf6
commit 4d6b4930b2
128 changed files with 18247 additions and 2093 deletions

View file

@ -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
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->foreignId('hub_id')
->nullable()
->after('partner_id')
->constrained('hubs')
->nullOnDelete();
$table->string('origin')
->nullable()
->after('hub_id')
->comment('style2own or stileigentum');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropForeign(['hub_id']);
$table->dropColumn(['hub_id', 'origin']);
});
}
};

View file

@ -0,0 +1,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('products', function (Blueprint $table) {
$table->foreignId('hub_id')
->nullable()
->after('collection_id')
->constrained('hubs')
->nullOnDelete();
$table->string('product_type')
->default('local_stock')
->after('slug')
->comment('local_stock or smart_order');
$table->string('price_type')
->default('fixed')
->after('status')
->comment('fixed, from_price, or on_request');
$table->string('price_display_text')
->nullable()
->after('price_type')
->comment('Custom display text like Ab 2.500 EUR');
$table->boolean('is_curated')
->default(false)
->after('meta_description');
$table->timestamp('curated_at')
->nullable()
->after('is_curated');
$table->foreignId('curated_by')
->nullable()
->after('curated_at')
->constrained('users')
->nullOnDelete();
$table->boolean('is_available')
->default(true)
->after('curated_by');
});
}
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropForeign(['hub_id']);
$table->dropForeign(['curated_by']);
$table->dropColumn([
'hub_id',
'product_type',
'price_type',
'price_display_text',
'is_curated',
'curated_at',
'curated_by',
'is_available',
]);
});
}
};

View file

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('partners', function (Blueprint $table) {
$table->text('story_text')
->nullable()
->after('description')
->comment('Partner story/about us text');
$table->json('opening_hours')
->nullable()
->after('story_text')
->comment('Structured opening hours');
$table->json('specialties')
->nullable()
->after('opening_hours')
->comment('Areas of expertise');
$table->integer('founded_year')
->nullable()
->after('specialties');
});
}
public function down(): void
{
Schema::table('partners', function (Blueprint $table) {
$table->dropColumn([
'story_text',
'opening_hours',
'specialties',
'founded_year',
]);
});
}
};

View file

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('group')->index();
$table->string('key');
$table->text('value')->nullable();
$table->string('type')->default('string')->comment('string, integer, boolean, json');
$table->text('description')->nullable();
$table->timestamps();
$table->unique(['group', 'key']);
});
}
public function down(): void
{
Schema::dropIfExists('settings');
}
};

View file

@ -0,0 +1,28 @@
<?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::table('product_variants', function (Blueprint $table) {
$table->unsignedBigInteger('tax_rate_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('product_variants', function (Blueprint $table) {
$table->unsignedBigInteger('tax_rate_id')->nullable(false)->change();
});
}
};

View file

@ -0,0 +1,66 @@
<?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::table('products', function (Blueprint $table) {
// Materialien & Beschaffenheit
$table->string('country_of_origin', 2)->nullable()->after('care_instructions');
$table->string('main_material')->nullable()->after('country_of_origin');
$table->string('surface_material')->nullable()->after('main_material');
$table->string('cover_material')->nullable()->after('surface_material');
$table->string('color_finish')->nullable()->after('cover_material');
$table->json('certificates')->nullable()->after('color_finish');
// Montage & Physisch
$table->integer('assembly_time_min')->nullable()->after('assembly_status');
$table->integer('load_capacity_kg')->nullable()->after('assembly_time_min');
// Lieferung & Services
$table->string('delivery_type')->nullable()->after('load_capacity_kg');
$table->boolean('assembly_service')->default(false)->after('delivery_type');
$table->integer('service_radius_km')->nullable()->after('assembly_service');
$table->integer('warranty_months')->nullable()->after('service_radius_km');
$table->integer('production_time_days')->nullable()->after('warranty_months');
// Sichtbarkeit
$table->date('visible_from')->nullable()->after('is_available');
$table->date('visible_until')->nullable()->after('visible_from');
// Nachhaltigkeit
$table->decimal('co2_footprint_kg', 8, 2)->nullable()->after('visible_until');
$table->integer('recycling_percentage')->nullable()->after('co2_footprint_kg');
$table->boolean('is_regional_production')->default(false)->after('recycling_percentage');
// Scoring (B2in intern)
$table->integer('storage_volume_liters')->nullable()->after('is_regional_production');
$table->tinyInteger('assembly_effort_score')->nullable()->after('storage_volume_liters');
$table->tinyInteger('design_score')->nullable()->after('assembly_effort_score');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn([
'country_of_origin', 'main_material', 'surface_material', 'cover_material',
'color_finish', 'certificates', 'assembly_time_min', 'load_capacity_kg',
'delivery_type', 'assembly_service', 'service_radius_km', 'warranty_months',
'production_time_days', 'visible_from', 'visible_until', 'co2_footprint_kg',
'recycling_percentage', 'is_regional_production', 'storage_volume_liters',
'assembly_effort_score', 'design_score',
]);
});
}
};

View file

@ -0,0 +1,31 @@
<?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::table('product_logistics', function (Blueprint $table) {
$table->string('packaging_type')->nullable()->after('location_bin');
$table->integer('packaging_recyclable_percent')->nullable()->after('packaging_type');
$table->boolean('is_palletizable')->default(false)->after('packaging_recyclable_percent');
$table->string('hs_code')->nullable()->after('is_palletizable');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('product_logistics', function (Blueprint $table) {
$table->dropColumn(['packaging_type', 'packaging_recyclable_percent', 'is_palletizable', 'hs_code']);
});
}
};

View file

@ -0,0 +1,28 @@
<?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::table('product_variants', function (Blueprint $table) {
$table->string('currency', 3)->default('EUR')->after('delivery_time_text');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('product_variants', function (Blueprint $table) {
$table->dropColumn('currency');
});
}
};

View file

@ -0,0 +1,35 @@
<?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('product_wood_origins', function (Blueprint $table) {
$table->id();
$table->foreignId('product_id')->constrained('products')->onDelete('cascade');
$table->string('wood_species');
$table->string('origin_country', 2);
$table->string('origin_region')->nullable();
$table->integer('harvest_year')->nullable();
$table->string('forest_operator')->nullable();
$table->string('sustainability_certificate')->nullable();
$table->string('eudr_reference_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_wood_origins');
}
};

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
// Product numbers on products table
Schema::table('products', function (Blueprint $table) {
$table->string('partner_product_number')->nullable()->after('partner_id');
$table->string('b2in_article_number')->nullable()->unique()->after('partner_product_number');
$table->boolean('visibleIsAvailable')->default(false)->after('is_available');
});
// Make SKU and selling_price nullable on product_variants
Schema::table('product_variants', function (Blueprint $table) {
$table->string('sku')->nullable()->change();
$table->integer('selling_price')->nullable()->change();
});
}
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn(['partner_product_number', 'b2in_article_number']);
});
Schema::table('product_variants', function (Blueprint $table) {
$table->string('sku')->nullable(false)->change();
$table->integer('selling_price')->nullable(false)->change();
});
}
};

View file

@ -0,0 +1,28 @@
<?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::table('products', function (Blueprint $table) {
$table->text('curation_notes')->nullable()->after('curated_by');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('curation_notes');
});
}
};

View file

@ -0,0 +1,31 @@
<?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('product_activities', function (Blueprint $table) {
$table->id();
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('action');
$table->text('note')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_activities');
}
};