If you ever faced this, which is obvious. Then you should remember there can be number of reasons for this to happen.
To understand this:
Suppose i have two tables. roles and users.
In you have a user table and there you have a foreign key called role_id which is indicating roles table.
Reason Number 1: So when you run migration, laravel expects to have role table before user table. cause role_id is coming from role table. you can place your migration file of role by renaming the date.
Reason Number 2: You can declare foreign key in many ways. interger, bigInteger, unsignedBigInteger. Don't forget to give the reference table name on the example: ->references('id')->on('roles')
To understand this:
Suppose i have two tables. roles and users.
In you have a user table and there you have a foreign key called role_id which is indicating roles table.
Reason Number 1: So when you run migration, laravel expects to have role table before user table. cause role_id is coming from role table. you can place your migration file of role by renaming the date.
Reason Number 2: You can declare foreign key in many ways. interger, bigInteger, unsignedBigInteger. Don't forget to give the reference table name on the example: ->references('id')->on('roles')
Comments
Post a Comment