32 lines
1.0 KiB
PHP
Executable File
32 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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('invoices', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('user_subscription_id')->constrained()->cascadeOnDelete();
|
|
$table->string('invoice_number')->unique();
|
|
$table->decimal('amount', 10, 2);
|
|
$table->string('currency', 3)->default('BRL');
|
|
$table->string('status')->default('pending'); // pending, paid, cancelled, refunded
|
|
$table->string('payment_method')->nullable();
|
|
$table->timestamp('paid_at')->nullable();
|
|
$table->string('pdf_path')->nullable();
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('invoices');
|
|
}
|
|
}; |