ssquare
11 months ago

Cannot insert duplicate key row in object 'dbo.student' with unique index 'dept_id_room_id_roll_id_unique'. The duplicate key value is (<NULL>, <NULL>, <NULL>)

Posted 11 months ago by ssquare

I have created migration as

            $table->bigInteger('dept_id')->unsigned()->nullable(); 
            $table->bigInteger('room_id')->unsigned()->nullable(); 
            $table->bigInteger('roll_id')->unsigned()->nullable();
            $table->unique(['dept_id', 'room_id','roll_id']);

I am using MsSQL 2017 as the database. It is not allowing to have null value in these unique columns for more than once. What I am missing?

Please sign in or create an account to participate in this conversation.