Skip to content

Commit 3b70b40

Browse files
update user_stats table migration: change 'last_read_notification_id' and 'last_read_notification_activity_id' to have 0 default value; update non_negative_columns constraint to include 'last_read_notification_id' and 'last_read_notification_activity_id'
1 parent bd6a3a5 commit 3b70b40

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎database/migrations/2026_10_11_160008_create_user_stats_table.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public function up(): void
1818
$table->unsignedBigInteger('following_count')->default(0);
1919
$table->unsignedBigInteger('notifications_count')->default(0);
2020
$table->unsignedBigInteger('posts_count')->default(0);
21-
$table->unsignedBigInteger('last_read_notification_id')->nullable();
22-
$table->unsignedBigInteger('last_read_notification_activity_id')->nullable();
21+
$table->unsignedBigInteger('last_read_notification_id')->default(0); // Easy to compare
22+
$table->unsignedBigInteger('last_read_notification_activity_id')->default(0); // Easy to compare
2323
$table->timestamps();
2424

2525
// Indexes
@@ -35,6 +35,8 @@ public function up(): void
3535
AND following_count >= 0
3636
AND notifications_count >= 0
3737
AND posts_count >= 0
38+
AND last_read_notification_id >= 0
39+
AND last_read_notification_activity_id >= 0
3840
)'
3941
);
4042
}

0 commit comments

Comments
 (0)