2025-07-23 15:41:01 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
|
|
|
|
return new class extends Migration
|
|
|
|
|
{
|
2025-07-26 05:22:58 +09:00
|
|
|
/**
|
|
|
|
|
* Run the migrations.
|
|
|
|
|
*/
|
|
|
|
|
public function up(): void
|
|
|
|
|
{
|
2025-07-23 15:41:01 +09:00
|
|
|
Schema::create('tenants', function (Blueprint $table) {
|
|
|
|
|
$table->bigIncrements('id')->comment('PK');
|
2025-07-26 05:22:58 +09:00
|
|
|
$table->string('company_name', 100)->comment('회사/조직명');
|
2025-07-23 15:41:01 +09:00
|
|
|
$table->string('code', 50)->unique()->comment('테넌트 코드');
|
|
|
|
|
$table->string('email', 80)->nullable()->comment('대표 이메일');
|
|
|
|
|
$table->string('phone', 20)->nullable()->comment('대표 전화번호');
|
2025-07-26 05:22:58 +09:00
|
|
|
$table->string('address')->nullable()->comment('주소');
|
|
|
|
|
$table->string('business_num', 12)->nullable()->comment('사업자등록번호(10자리)');
|
|
|
|
|
$table->string('corp_reg_no', 13)->nullable()->comment('법인등록번호(13자리, 법인만)');
|
|
|
|
|
$table->string('ceo_name', 50)->nullable()->comment('대표자명');
|
|
|
|
|
$table->string('homepage')->nullable()->comment('홈페이지 주소');
|
|
|
|
|
$table->string('fax', 30)->nullable()->comment('팩스번호');
|
|
|
|
|
$table->string('logo')->nullable()->comment('회사 로고 이미지 경로');
|
|
|
|
|
$table->text('admin_memo')->nullable()->comment('관리자 메모/비고');
|
|
|
|
|
$table->json('options')->nullable()->comment('회사별 옵션 정보(확장용 JSON)');
|
2025-07-23 15:41:01 +09:00
|
|
|
$table->string('tenant_st_code', 20)->default('trial')->comment('테넌트 상태(trial,active,suspended,cancelled)');
|
|
|
|
|
$table->unsignedBigInteger('plan_id')->nullable()->comment('현재 요금제(플랜) ID');
|
|
|
|
|
$table->unsignedBigInteger('subscription_id')->nullable()->comment('현재 구독 정보 ID');
|
|
|
|
|
$table->integer('max_users')->default(10)->comment('최대 사용자 수');
|
|
|
|
|
$table->dateTime('trial_ends_at')->nullable()->comment('트라이얼 종료일');
|
|
|
|
|
$table->dateTime('expires_at')->nullable()->comment('계약 만료일');
|
|
|
|
|
$table->dateTime('last_paid_at')->nullable()->comment('마지막 결제일');
|
|
|
|
|
$table->string('billing_tp_code', 20)->default('monthly')->comment('결제 주기(monthly,yearly)');
|
|
|
|
|
$table->timestamps();
|
|
|
|
|
$table->softDeletes();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-26 05:22:58 +09:00
|
|
|
/**
|
|
|
|
|
* Reverse the migrations.
|
|
|
|
|
*/
|
|
|
|
|
public function down(): void
|
|
|
|
|
{
|
2025-07-23 15:41:01 +09:00
|
|
|
Schema::dropIfExists('tenants');
|
|
|
|
|
}
|
|
|
|
|
};
|