feat: [tenant] AI 토큰 한도 컬럼 추가 및 저장공간 100GB 변경
- tenant.ai_token_limit 추가 (기본값 월 100만 토큰) - tenant.storage_limit 기본값 10GB → 100GB 변경 - 기존 10GB 테넌트를 100GB로 일괄 업데이트
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?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
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* - ai_token_limit 컬럼 추가 (월 100만 토큰 기본)
|
||||
* - storage_limit 기본값 10GB → 100GB 변경
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->bigInteger('ai_token_limit')
|
||||
->default(1000000)
|
||||
->after('storage_grace_period_until')
|
||||
->comment('월별 AI 토큰 한도 (기본 100만)');
|
||||
});
|
||||
|
||||
// 기존 storage_limit 기본값 10GB인 테넌트를 100GB로 변경
|
||||
DB::table('tenants')
|
||||
->where('storage_limit', 10737418240) // 10GB
|
||||
->update(['storage_limit' => 107374182400]); // 100GB
|
||||
|
||||
// 새로 생성되는 테넌트의 기본값도 100GB로 변경
|
||||
DB::statement('ALTER TABLE tenants ALTER COLUMN storage_limit SET DEFAULT 107374182400');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// storage_limit 기본값 복원
|
||||
DB::statement('ALTER TABLE tenants ALTER COLUMN storage_limit SET DEFAULT 10737418240');
|
||||
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->dropColumn('ai_token_limit');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user