Files
sam-api/database/migrations/2025_07_26_051643_create_subscriptions_table.php
kent b436b635c2 fix : 테이블 추가 및 수정 신규로 작성 (generator 설치)
composer require --dev kitloong/laravel-migrations-generator
php artisan migrate:generate
2025-07-26 05:22:58 +09:00

34 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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('subscriptions', function (Blueprint $table) {
$table->bigIncrements('id')->comment('PK');
$table->unsignedBigInteger('tenant_id')->index('subscriptions_tenant_id_foreign');
$table->unsignedBigInteger('plan_id')->index('subscriptions_plan_id_foreign');
$table->date('started_at')->comment('구독 시작일');
$table->date('ended_at')->nullable()->comment('구독 종료일(해지시)');
$table->string('status', 20)->default('active')->comment('상태(active, canceled, expired 등)');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('subscriptions');
}
};