31 lines
916 B
PHP
31 lines
916 B
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
|
|
{
|
|
if (isSaas()) {
|
|
Schema::create('referrals', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
|
$table->foreignId('company_id')->constrained('users')->onDelete('cascade');
|
|
$table->decimal('commission_percentage', 5, 2);
|
|
$table->decimal('amount', 10, 2);
|
|
$table->foreignId('plan_id')->nullable()->constrained()->onDelete('set null');
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if (isSaas()) {
|
|
Schema::dropIfExists('referrals');
|
|
}
|
|
}
|
|
};
|