37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('kyc_documents', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->string('category', 24); // identity | address | payment
|
|
$table->string('type', 32); // passport | driver_license | id_card | bank_statement | utility_bill | other
|
|
$table->string('status', 16)->default('pending'); // pending | approved | rejected
|
|
$table->string('rejection_reason', 255)->nullable();
|
|
$table->string('file_path');
|
|
$table->string('mime', 100);
|
|
$table->unsignedBigInteger('size');
|
|
$table->timestamp('submitted_at')->nullable();
|
|
$table->timestamp('reviewed_at')->nullable();
|
|
$table->foreignId('reviewed_by')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->softDeletes();
|
|
$table->timestamps();
|
|
|
|
$table->index(['user_id', 'status']);
|
|
$table->index('category');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('kyc_documents');
|
|
}
|
|
};
|