Skip to content

Notifications table continues to throw duplicate entry for id column #44765

@sts-ryan-holton

Description

@sts-ryan-holton
  • Laravel Version: 9.37.0
  • PHP Version: 8.1.9
  • Database Driver & Version: MySQL 5.7

Description:

When sending notifications, the notifications table throws the following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '67f394ac-b1be-4300-8a7e-7f4daf6f65ee' for key 'PRIMARY' in /var/www/domain-monitor-api/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545

Steps To Reproduce:

I have 85,000 notifications in my notifications table for reference.

I've come across this discussion from 2019, except my notifications table's id column length is perfectly fine at 36 characters, what's more, my table migration for notifications for the id column also matches recommendations:

Schema::create('notifications', function (Blueprint $table) {
    $table->uuid('id')->primary();
    $table->string('type');
    $table->morphs('notifiable');
    $table->text('data');
    $table->timestamp('read_at')->nullable();
    $table->timestamps();
});

I'm not sure why this keeps happening randomly, I'll attach a screenshot of my phpmyadmin table structure for notifications as I get this error randomly both locally and in production - I think others will be getting this error still 👍
notification_table_schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions