feat: [tenant] 데모 테넌트 지원 추가 (Phase 1)
- tenants.tenant_type ENUM 확장: DEMO_SHOWCASE, DEMO_PARTNER, DEMO_TRIAL - demo_expires_at, demo_source_partner_id 컬럼 추가 - Tenant 모델에 데모 관련 메서드 추가 (isDemoTenant, isDemoShowcase 등) - getOption/setOption 헬퍼 메서드 추가 - 데모→정식 전환 convertToProduction() 메서드
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 데모 테넌트 지원을 위한 tenants 테이블 확장
|
||||
*
|
||||
* - tenant_type ENUM에 데모 유형 추가 (DEMO_SHOWCASE, DEMO_PARTNER, DEMO_TRIAL)
|
||||
* - demo_expires_at: 체험 만료일 (Tier 3 고객 체험 30일 제한)
|
||||
* - demo_source_partner_id: 데모를 생성한 영업파트너 ID
|
||||
*
|
||||
* @see docs/features/sales/demo-tenant-policy.md
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// tenant_type ENUM 확장: 기존 STD/TPL/HQ + 데모 유형 3개
|
||||
DB::statement("ALTER TABLE tenants MODIFY COLUMN tenant_type ENUM('STD', 'TPL', 'HQ', 'DEMO_SHOWCASE', 'DEMO_PARTNER', 'DEMO_TRIAL') NOT NULL DEFAULT 'STD' COMMENT '테넌트 유형: STD=일반, TPL=템플릿, HQ=본사, DEMO_SHOWCASE=공용데모, DEMO_PARTNER=파트너데모, DEMO_TRIAL=고객체험'");
|
||||
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->datetime('demo_expires_at')
|
||||
->nullable()
|
||||
->after('trial_ends_at')
|
||||
->comment('데모 만료일시 (Tier 3: 생성일+30일)');
|
||||
|
||||
$table->unsignedBigInteger('demo_source_partner_id')
|
||||
->nullable()
|
||||
->after('demo_expires_at')
|
||||
->comment('데모 생성 영업파트너 ID (sales_partners.id)');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->dropColumn(['demo_expires_at', 'demo_source_partner_id']);
|
||||
});
|
||||
|
||||
// tenant_type ENUM 원복
|
||||
DB::statement("ALTER TABLE tenants MODIFY COLUMN tenant_type ENUM('STD', 'TPL', 'HQ') NOT NULL DEFAULT 'STD' COMMENT '테넌트 유형: STD=일반, TPL=템플릿, HQ=본사'");
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user