File: /var/www/html/api.aianced.com/database/migrations/2026_03_16_000002_create_analysis_logs_table.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('analysis_logs', function (Blueprint $table) {
$table->id();
$table->string('ip_address', 45)->nullable();
$table->string('idea_snippet', 200); // first 200 chars only
$table->string('product_type', 80)->nullable();
$table->string('business_model', 80)->nullable();
$table->boolean('success')->default(true);
$table->string('failure_reason', 120)->nullable();
$table->timestamp('created_at')->useCurrent();
$table->index('ip_address');
$table->index('created_at');
});
}
public function down(): void
{
Schema::dropIfExists('analysis_logs');
}
};