From 4d1dd77a369b93d83ad51ef8755fa49efa9b32d2 Mon Sep 17 00:00:00 2001 From: Chris Mellor Date: Sat, 16 May 2026 21:50:02 +0100 Subject: [PATCH] refactor(migrations): use explicit column name for activity FK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces `foreignIdFor(Activity::class)` with `foreignId('activity_id')` in the streak_histories stub to match the package's established convention (14 other FK declarations all use the explicit-column form). Schema is byte-identical for both new and existing installs — `foreignIdFor` derives the same `activity_id` column name from the model basename. Also removes the now-unused `Activity` import. --- database/migrations/create_streak_histories_table.php.stub | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database/migrations/create_streak_histories_table.php.stub b/database/migrations/create_streak_histories_table.php.stub index d93c058..466be05 100644 --- a/database/migrations/create_streak_histories_table.php.stub +++ b/database/migrations/create_streak_histories_table.php.stub @@ -3,7 +3,6 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -use LevelUp\Experience\Models\Activity; return new class extends Migration { @@ -12,7 +11,7 @@ return new class extends Migration Schema::create(table: 'streak_histories', callback: function (Blueprint $table) { $table->id(); $table->foreignId(column: config(key: 'level-up.user.foreign_key'))->constrained(table: config(key: 'level-up.user.users_table'))->cascadeOnDelete(); - $table->foreignIdFor(model: Activity::class)->constrained(table: 'streak_activities'); + $table->foreignId(column: 'activity_id')->constrained(table: 'streak_activities'); $table->integer(column: 'count')->default(value: 1); $table->timestamp(column: 'started_at'); $table->timestamp(column: 'ended_at')->nullable();