fix(migrations): align ai_conversations company_id/user_id with INT pk (#683)

Follow-up to #618. The ai_conversations table (added after #618) used
foreignId() (BIGINT) for company_id/user_id, which mismatches the INT
UNSIGNED users.id / companies.id and breaks MySQL FK creation (error 3780)
on the v2->v3 upgrade. Use plain unsignedInteger, matching the codebase's
no-DB-FK convention for these columns. conversation_id stays foreignId — it
references the BIGINT ai_conversations.id and its delete cascade is intentional
(and covered by AiChatFlowTest).
This commit is contained in:
Darko Gjorgjijoski
2026-06-12 15:19:21 +02:00
committed by GitHub
parent 217deb0bf9
commit a2aa74aa8a

View File

@@ -10,8 +10,8 @@ return new class extends Migration
{
Schema::create('ai_conversations', function (Blueprint $table) {
$table->id();
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('company_id');
$table->unsignedInteger('user_id');
$table->string('title')->nullable();
$table->string('model', 100)->nullable();
$table->timestamps();