SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'posts_user_id_foreign'; check that column/key exists
Error SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'posts_user_id_foreign'; check that column/key exists occurs when you try to delete the foreign key which does not already exist in your table.
-
Check constraints name 'posts_user_id_foreign' exists or not in SQL
SELECT `TABLE_SCHEMA`, `TABLE_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `CONSTRAINT_NAME` IN ('posts_user_id_foreign')
You can use the SQL query to check the CONSTRAINT_NAME 'posts_user_id_foreign' exists or not.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- Define variable and use in Laravel controller method
- Shorter syntax for whereHas with call back function in laravel
- Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0"
- If condition in foreach loop in laravel
- How to display order by null last in laravel
- Permanently delete a record in laravel
- How to use more than one query scope in Laravel
- Update last created record in Laravel
- Class 'App\Providers\Auth' not found
- Target class [HomeController] does not exist
- SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist
- Laravel get all records with pagination
- How to get CSRF token in laravel controller
- How to create new user without form submission in laravel
- Laravel URL validation not working
- Composer create project laravel/laravel example app
- Get last record from table in laravel
- How to upload multiple images after preview in laravel using cropper js
- How to delete record in Laravel with ajax
- Get Array of IDs from Eloquent Collection
- Database transactions in laravel
- How to send ID to another page in Laravel
- Sample configuration files to create laravel project with docker using wsl (window subsystem linux)
- Input file with max size validation in laravel
- How to remove package from laravel