Answer the question
In order to leave comments, you need to log in
To add foreign_key on the current table from which we add a key?
Referral system, table of users id | referral_id . When trying to put a foreign key on the same table
$table->foreign('refferral_id')->references('id')->on('users')->onDelete('set null');
nvalid foreign key: 7 ERROR: there is no unique constraint matching given keys for referenced table
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question