Integrity constraint violation: 1062 Duplicate entry ” for key ‘modules_code_unique’

Laraship QuestionsCategory: TechnicalIntegrity constraint violation: 1062 Duplicate entry ” for key ‘modules_code_unique’
scott asked 4 years ago
From the logs, I am getting this error after a fresh install: [previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'modules_code_unique' at /var/www/html/dev/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:127 We're running php 7.2 on Ubuntu 18.04 via an AWS EC2 Instance.  The database was empty during the install.  The website threw the 500 error and the above was in the logs.  If you need more info, please ask. Thanks! Scott Kallen Kingfisherfiles.com
1 Answers
laraship Staff answered 4 years ago
Hello, I think you're trying to do fresh installation on an existing application, please try cleaning cache by running the clear cache at corals installer command  
scott replied 4 years ago

In frustration, I deleted every file and dropped and recreated the database. The steps were:

1) Delete all in the directory, including hidden files relating to .env and .git
2) Dropped the database, restarted the DB editor and re-created the database.
3) Rebooted the server.
4) Ran the One Command Installer. Entered all the necessary data.
5) After confiming the fresh install, it stopped with these errors:

debugbar:clear
Debugbar Storage cleared!

5/5 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

Cache cleared.

In Connection.php line 671:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ” for key ‘modules_code_unique’ (SQL: insert into `modules` (`created_by`, `updated_by`, `updated_at`, `created_at`) values (?, ?, 2020
-08-14 20:43:55, 2020-08-14 20:43:55))

In PDOStatement.php line 129:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ” for key ‘modules_code_unique’

In PDOStatement.php line 127:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ” for key ‘modules_code_unique’

scott replied 4 years ago

P.S. I tried to clear the cache using the installer BEFORE I tried the above. Also, after this error happened, I cleared the cache again using the installer and and tried to install again — it seemed to install the rest of the way. But now I get a blank screen when I go to the site.

I believe the error I reported earlier is most likely a result of the failed initial install. But you folks are the experts. Please advise.

scott replied 4 years ago

More data: When I did yet another cache clear, I was able to get the main page to display but none of the subsequent links worked. See my other question:

https://www.laraship.com/question/login-registration-contact-us-all-route-to-404-not-found/#comment-2339220

Thanks.