44 lines
1.5 KiB
PHP
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
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('partners', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('company_name');
|
|
$table->string('slug')->unique();
|
|
|
|
// Partner-Typ (gemäß Wissensbasis)
|
|
$table->string('type'); // 'Retailer', 'Manufacturer', 'Estate-Agent'
|
|
|
|
// Hub-Zugehörigkeit (kann NULL sein für "globale" Hersteller)
|
|
$table->foreignId('hub_id')->nullable()->constrained()->onDelete('set null');
|
|
|
|
$table->text('description')->nullable();
|
|
$table->string('logo_url')->nullable();
|
|
$table->boolean('is_active')->default(false);
|
|
|
|
// Spezifische Felder für 'Retailer' (Händler)
|
|
$table->integer('delivery_radius_km')->nullable();
|
|
$table->integer('assembly_radius_km')->nullable();
|
|
|
|
// Flexible Provisions-Engine (pro Partner)
|
|
// Speichert den Wert in Cents, um Rundungsfehler zu vermeiden
|
|
$table->integer('provision_fixed_amount')->nullable();
|
|
// Speichert als 10.5 für 10.5%
|
|
$table->decimal('provision_rate_percentage', 5, 2)->nullable();
|
|
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('partners');
|
|
}
|
|
};
|