composer require --dev kitloong/laravel-migrations-generator php artisan migrate:generate
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('payments', function (Blueprint $table) {
|
|
$table->bigIncrements('id')->comment('PK');
|
|
$table->unsignedBigInteger('subscription_id')->index('payments_subscription_id_foreign');
|
|
$table->decimal('amount', 12)->comment('결제금액');
|
|
$table->string('payment_method', 30)->comment('결제수단');
|
|
$table->string('transaction_id', 100)->nullable()->comment('PG 거래ID');
|
|
$table->dateTime('paid_at')->comment('결제일시');
|
|
$table->string('status', 20)->default('paid')->comment('결제상태(paid, failed 등)');
|
|
$table->text('memo')->nullable()->comment('비고');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('payments');
|
|
}
|
|
};
|