Files
sam-api/database/migrations/2025_12_17_120000_create_cards_table.php
hskwon e1b0c99d5d feat: 2.3 카드/계좌 관리 API 구현
- cards, bank_accounts 테이블 마이그레이션
- Card, BankAccount 모델 (카드번호 암호화)
- CardService, BankAccountService
- CardController, BankAccountController + FormRequest 4개
- API 엔드포인트 15개 (카드 7개, 계좌 8개)
- Swagger 문서 (CardApi.php, BankAccountApi.php)
2025-12-17 21:02:20 +09:00

44 lines
1.7 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('cards', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->string('card_company', 50)->comment('카드사');
$table->text('card_number_encrypted')->comment('암호화된 카드번호');
$table->string('card_number_last4', 4)->comment('카드번호 끝 4자리');
$table->string('expiry_date', 5)->comment('유효기간 (MM/YY)');
$table->text('card_password_encrypted')->nullable()->comment('암호화된 비밀번호 앞2자리');
$table->string('card_name', 100)->comment('카드 별칭');
$table->string('status', 20)->default('active')->comment('상태: active/inactive');
$table->unsignedBigInteger('assigned_user_id')->nullable()->comment('담당자 ID');
$table->unsignedBigInteger('created_by')->nullable()->comment('생성자 ID');
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자 ID');
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자 ID');
$table->softDeletes();
$table->timestamps();
$table->index('tenant_id', 'idx_cards_tenant');
$table->index('status', 'idx_cards_status');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cards');
}
};