In Laravel why I get error for this migration: public function up() {…
- User
In Laravel why I get error for this migration:
public function up() { Schema::create('filters', function (Blueprint table) { table->id(); table->unsignedBigInteger('filter_type_id'); $table->boolean('status')->default(0);
- Assistant
This error occurs because there is a mismatch between the data types of the columns used for the foreign key constraint.
Make sure that the
idcolumn in thefilter_typetable is of the same data type as thefilter_type_idcolumn in thefilterstable.Also, check if the
filter_typetable already exists in the database before running this migration. If not, create thefilter_typetable first and then run the migration again.