?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('order_item_id')->constrained()->cascadeOnDelete()->index(); $table->string('status')->default('active')->index(); $table->timestamp('current_period_start')->nullable(); $table->timestamp('current_period_end')->nullable(); $table->timestamp('next_invoice_at')->nullable()->index(); $table->boolean('cancel_at_period_end')->default(false); $table->timestamp('cancelled_at')->nullable(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('subscriptions'); } };