SQLSTATE[HY000]: General error: 3780 Referencing column 'role_id' and referenced column 'id' in foreign key constraint 'user_role_id foreign' are incompatible.

As the name says the referenced foreign key and the id in the table are not of 
same type. 

Example : 

// user_id foreign key referenced table
$table->bigInteger('user_id')->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');


// Then inside users table
$table->bigIncrements('id')->unsigned()->index();

4
1
Cliff 100 points

                                    $table->bigInteger('user_id')->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

4 (1 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
General error: 3780 Referencing column '' and referenced column '' in foreign key constraint '' are incompatible. General error: 3780 Referencing column 'i_id' and referenced column 'p_id' in foreign key constraint 'images_i_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'id_customer' and referenced column 'id' in foreign key constraint 'customers_activations_id_customer_foreign' are incompatible General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'tasks_user_id_foreign' are incompatible Error Code: 3780. Referencing column 'post_id' and referenced column 'id' in foreign key constraint 'job_app_ibfk_1' are incompatible. 0.000 sec Error Code: 3780. Referencing column 'city_id' and referenced column 'id' in foreign key constraint 'fk_city' are incompatible. OperationalError: (3780, Referencing column project_id and referenced column id in foreign key constraint project_id_refs_id_fa0c278d are incompatible.) OperationalError: (3780, "Referencing column 'project_id' and referenced column 'id' in foreign key constraint 'project_id refs_id_fa0c278d' are incompatible.") Error Code: 3780. Referencing column 'client_id' and referenced column 'id' in foreign key constraint 'tbl_clients_representatives_ibfk_1' are incompatible SQLSTATE[HY000]: General error: 3780 Referencing column 'category_id' and referenced column 'id' in foreign key constraint _id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'car_id' and referenced column 'id' in foreign key constraint General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'phones user_id foreign' are incompatible General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'phones_user_id_foreign' are incompatible General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'tweets_user_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'users_profile_user_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'student_id' and referenced column 'id' in foreign key constraint 'diva_comments_student_id_foreign' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'users_roles_user_id_foreign' are incompatible. General error: 3780 Referencing column 'company_id' and referenced column 'id' in foreign key constraint 'sms_templates_company_id_foreign' are incompatible. error Code: 3780. Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'nobo_nps_ibfk_1' are incompatible. 0.016 sec Error Code: 3780. Referencing column 'id_pais' and referenced column 'id' in foreign key constraint 'dados_cnpj_ibfk_1' are incompatible. Error Code: 3780. Referencing column 'id_client' and referenced column 'id_client' in foreign key constraint 'orders_archive_fk0' are incompatible. mysql Error Code: 3780. Referencing column 'instructor_id' and referenced column 'id' in foreign key constraint 'classrooms_instructor_id_foreign' are incompatible. 3780, "Referencing column 'user_id' and referenced column 'user_id' in foreign key constraint 'result_ibfk_2' are incompatible. 3780 Referencing column 'admin_attribute_id' and referenced column 'id' in foreign key constraint 'attribute_mapping_admin_attribute_id_foreign' are incompatible. #3780 - Referencing column 'profile_id' and referenced column 'id' in foreign key constraint 'SUPPLIER_ATTRIBUTE_PROFILE_ID' are incompatible. General error: 3780 Referencing column 'id' and referenced column 'attribute_id' in foreign key constraint 'admin_attributes_id_foreign' are incompatible General error: 3780 Referencing column 'commande id' and referenced column 'id' in foreign key constraint 'commande_meal_commande_id_foreign' are incompatible. General error: 3780 Referencing column 'commande_id' and referenced column 'id' in foreign key constraint 'commande_meal_commande_id_foreign' are incompatible. General error: 3780 Referencing column 'property_id' and referenced column 'id' in foreign key constraint 'threads_property_id_foreign' are incompatible SQLSTATE[HY000]: General error: 3780 Referencing column 'author_id' and referenced column 'id' in foreign key constraint 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint SQLSTATE[HY000]: General error: 3780 Referencing column 'users_id' and referenced column 'id' in foreign key constraint 'languages_users_id_foreign' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constra int 'posts_user_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'category_id' and referenced column 'id' in foreign key laravel SQLSTATE[HY000]: General error: 3780 Referencing column 'performed_by' and referenced column 'id' in foreign key constraint 'tasks_performed_by_foreign' are incompatible General error: 3780 Referencing column 'article_id' and referenced column 'id' in foreign key constraint 'article_categories_article_id_foreign' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'contacts_user_id_foreign' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'role_user_user_id_foreign SQLSTATE[HY000]: General error: 3780 Referencing column 'emp_id' and referenced column 'id' in foreign key constraint 'attendance_emp_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'roles_id' and referenced column 'id' in foreign key constraint 'users_roles_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'token_id' and referenced column 'id' in foreign key constraint General error: 3780 Referencing column 'token_id' and referenced column 'id' in foreign key constraint General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'user_social_user_id_foreign' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 3780 Referencing column 'branch_id' and referenced column 'id' in foreign key constraint 'open__accounts_branch_id_foreign' are incompatible. Error Code: 3780. Referencing column 'instructor_id' and referenced column 'id' in foreign key constraint 'training_ibfk_1' are incompatible. General error: 3780 Referencing column 'created_by' and referenced column 'id' in foreign key constraint 'asset_maintenance_histories_creat ed_by_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'premium_customer' and referenced column 'id' in foreign key constraint 'orders_premium_customer_foreign' are incompatible. laravel General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'installations user_id foreign' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'installations_user_id_foreign' are incompatible. General error: 3780 Referencing column 'city_id' and referenced column 'id' in foreign key constraint 'deals_city_id_foreign' are incompatible. General error: 3780 Referencing column 'city_id' and referenced column 'id' in foreign key constraint 'deals_city_id_foreign' are incompatible." General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'posts_user_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'country_id' and referenced column 'id' in foreign key constraint 'users_country_id_foreign' are incompatible. Referencing column 'image_id' and referenced column 'id' in foreign key constraint 'shows_image_id_foreign' are incompatible. laravel laravel 8 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'companies_user_id_foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint PDOException::("SQLSTATE[HY000]: General error: 3780 laravel referencing column incompatible foreign key constraints are incompatible laravel Referencing column 'group_id' and referenced column 'id' in foreign key constraint 'bookmarks_group_id_foreign' are incompatible. Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'products_user_id_foreign' are incompatible. laravel Referencing column '' and referenced column 'id' in foreign key constraint '_foreign' are incompatible General error: 3780 Referencing column 'tag_id' and referenced column 'id' in foreign key constraint 'article_tag_tag_id_foreign' are incompatible. incompatible laravle forigh key Referencing column 'state_id' and referenced column 'id' in foreign key constraint 'users_state_id_foreign' are incompatible. ERROR 3780: Referencing column and referenced column 'id' in foreign key constraint are incompatible. eloquent referencing column and referenced column are incompatible PDOException::("SQLSTATE[HY000]: General error: 3780 Referencing Referencing column 'tenant_id' and referenced column 'id' in foreign key constraint laravel #3780 - Referencing column 'country_id' and referenced column 'id' in foreign key constraint 'sur_states_ibfk_1' are incompatible. #3780 - Referencing column 'countries_id' and referenced column 'id' in foreign key constraint 'sur_states_ibfk_1' are incompatible. General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint laravle SQL Error [3780] [HY000]: Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'orders_user_id_fk' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'role_id' and referenced column 'id' in foreign key constraint 'user_role_id foreign' are incompatible. SQLSTATE[HY000]: General error: 3780 Referencing column 'role_id' and referenced column 'id' in foreign key constraint 'users_role_id_foreign' are incompatible.
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source