30 lines
1.0 KiB
PHP
30 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('event_purchases', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
|
$table->unsignedInteger('events_purchased')->default(1);
|
|
$table->decimal('amount', 10, 2);
|
|
$table->string('currency', 3)->default('EUR');
|
|
$table->string('provider', 32); // stripe, paypal, app_store, play_store
|
|
$table->string('external_receipt_id')->nullable();
|
|
$table->string('status', 16)->default('pending'); // pending, completed, failed
|
|
$table->timestamp('purchased_at')->nullable();
|
|
$table->timestamps();
|
|
$table->index(['tenant_id', 'purchased_at']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('event_purchases');
|
|
}
|
|
}; |