Files
animexe/database/migrations/2024_01_01_000080_create_subscriptions_table.php
T
2026-07-14 00:01:48 +03:00

29 lines
1.0 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('subscriptions', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('plan_id')->constrained('membership_plans')->onDelete('cascade');
$table->enum('status', ['active', 'expired', 'cancelled'])->default('active');
$table->timestamp('starts_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->string('payment_method')->nullable(); // 'manual', 'stripe', vb.
$table->string('payment_ref')->nullable();
$table->text('notes')->nullable(); // admin notu
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('subscriptions');
}
};