feat: add referral_code

This commit is contained in:
2026-06-06 13:10:25 +03:30
parent 0f5f7835e7
commit 6c602af9eb
5 changed files with 120 additions and 0 deletions
@@ -0,0 +1,27 @@
<?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) {
// When the referral free-month subscription was granted (null = not yet).
if (!Schema::hasColumn('users', 'referral_subscription_granted_at')) {
$table->timestamp('referral_subscription_granted_at')->nullable()->after('referred_by');
}
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'referral_subscription_granted_at')) {
$table->dropColumn('referral_subscription_granted_at');
}
});
}
};