Hi!
When I update my self-hosted v5, the app shows a 500 error. I can ignore the error, as the app gets updated and everything works without issues.
However, I’d like to understand what happens here:
[2024-09-02 10:55:56] production.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'invoices_project_id_deleted_at_index' (Connection: db-ninja-01, SQL: alter table `invoices` add index `invoices_project_id_deleted_at_index`(`project_id`, `deleted_at`)) {"userId":1,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'invoices_project_id_deleted_at_index' (Connection: db-ninja-01, SQL: alter table `invoices` add index `invoices_project_id_deleted_at_index`(`project_id`, `deleted_at`)) at /public_html/invoiceninja-v5/vendor/laravel/framework/src/Illuminate/Database/Connection.php:825)
[stacktrace]
#0 /public_html/invoiceninja-v5/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('alter table `in...', Array, Object(Closure))
#1 /public_html/invoiceninja-v5/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run('alter table `in...', Array, Object(Closure))
#2 /public_html/invoiceninja-v5/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(117): Illuminate\\Database\\Connection->statement('alter table `in...')
#3 /public_html/invoiceninja-v5/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(565): Illuminate\\Database\\Schema\\Blueprint->build(Object(Illuminate\\Database\\MySqlConnection), Object(Illuminate\\Database\\Schema\\Grammars\\MySqlGrammar))
#4 /public_html/invoiceninja-v5/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(407): Illuminate\\Database\\Schema\\Builder->build(Object(Illuminate\\Database\\Schema\\Blueprint))
INFO Running migrations.
2024_07_10_043241_2024_07_10_invoice_id_index_on_projects_table 9.51ms FAIL
In Connection.php line 825:
SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
'invoices_project_id_deleted_at_index' (Connection: db-ninja-01, SQL: alter
table `invoices` add index `invoices_project_id_deleted_at_index`(`project
_id`, `deleted_at`))
In Connection.php line 571:
SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
'invoices_project_id_deleted_at_index'
You can fix this by commenting out the code in the 2024_07_10_043241_2024_07_10_invoice_id_index_on_projects_table migration file and running migrate again.
First try commenting out this line:
If that doesn’t fix it also comment out this line: