As title, i run a docker stack and when i updated the invoiceninja container something broke in the db, what command can i give to the mysql db to fix that? thank you
invoiceninja | In Connection.php line 678:
invoiceninja |
invoiceninja | SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
invoiceninja | 'expenses_company_id_number_unique' (SQL: alter table `expenses` add unique
invoiceninja | `expenses_company_id_number_unique`(`company_id`, `number`))
invoiceninja |
invoiceninja |
invoiceninja | In Exception.php line 18:
invoiceninja |
invoiceninja | SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
invoiceninja | 'expenses_company_id_number_unique'
invoiceninja |
invoiceninja |
invoiceninja | In PDOStatement.php line 115:
invoiceninja |
invoiceninja | SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
invoiceninja | 'expenses_company_id_number_unique
hillel
April 1, 2021, 7:32pm
2
Hi,
I suggest creating an issue on the repo for help with Docker
there’s already one created before this post
opened 06:13PM - 01 Apr 21 UTC
closed 05:57AM - 02 Apr 21 UTC
question
As title, i run a docker stack and when i updated the invoiceninja container som… ething broke in the db, what command can i give to the mysql db to fix that? than you
```
invoiceninja | In Connection.php line 678:
invoiceninja |
invoiceninja | SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
invoiceninja | 'expenses_company_id_number_unique' (SQL: alter table `expenses` add unique
invoiceninja | `expenses_company_id_number_unique`(`company_id`, `number`))
invoiceninja |
invoiceninja |
invoiceninja | In Exception.php line 18:
invoiceninja |
invoiceninja | SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
invoiceninja | 'expenses_company_id_number_unique'
invoiceninja |
invoiceninja |
invoiceninja | In PDOStatement.php line 115:
invoiceninja |
invoiceninja | SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name
invoiceninja | 'expenses_company_id_number_unique
```
edit: i found the duplicates, how can i remove them?
```
mysql> SHOW INDEX FROM expenses FROM invoiceninja;
+----------+------------+--------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+--------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| expenses | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 0 | expenses_company_id_number_unique | 1 | company_id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 0 | expenses_company_id_number_unique | 2 | number | A | 0 | NULL | NULL | YES | BTREE | | |
| expenses | 1 | expenses_company_id_deleted_at_index | 1 | company_id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 1 | expenses_company_id_deleted_at_index | 2 | deleted_at | A | 0 | NULL | NULL | YES | BTREE | | |
| expenses | 1 | expenses_user_id_foreign | 1 | user_id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 1 | expenses_company_id_index | 1 | company_id | A | 0 | NULL | NULL | | BTREE | | |
+----------+------------+--------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
```
hillel
April 1, 2021, 7:45pm
4
Please try to only post in one place, for Docker the best place is the Docker repo.
i’ll keep that in mind but this is a mysql error
i found the db duplicated entries, now how can i delete which one?
mysql> SHOW INDEX FROM expenses;
+----------+------------+--------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+--------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| expenses | 0 | PRIMARY | 1 | id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 0 | expenses_company_id_number_unique | 1 | company_id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 0 | expenses_company_id_number_unique | 2 | number | A | 0 | NULL | NULL | YES | BTREE | | |
| expenses | 1 | expenses_company_id_deleted_at_index | 1 | company_id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 1 | expenses_company_id_deleted_at_index | 2 | deleted_at | A | 0 | NULL | NULL | YES | BTREE | | |
| expenses | 1 | expenses_user_id_foreign | 1 | user_id | A | 0 | NULL | NULL | | BTREE | | |
| expenses | 1 | expenses_company_id_index | 1 | company_id | A | 0 | NULL | NULL | | BTREE | | |
+----------+------------+--------------------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
i deleted the expenses_company_id_number_unique index but the problem persist, there’s something wrong on the migration