uvdesk / core-framework

UVDesk Community Helpdesk Core Framework Bundle providing the core essential functionalities and integration tools to easily integrate any other community helpdesk packages.
https://www.uvdesk.com
MIT License
60 stars 50 forks source link

Error with update users - SQL Unique constraint #197

Closed alessioluciano closed 4 years ago

alessioluciano commented 5 years ago

People, I found an error when i try to update a user profile. The error shows that SQL engine don't allow me to execute an update because an unique constraint at timezone and timeformat. We drop that index at 'uv_user' table and allow me to update the user. Finally searching at User Entity we found the ORM definition with 'unique = true'.

MariaDB [uvdesk]> show index from uv_user; +---------+------------+-----------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +---------+------------+-----------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | uv_user | 0 | PRIMARY | 1 | id | A | 25 | NULL | NULL | | BTREE | | | | uv_user | 0 | UNIQ_E8D39F61E7927C74 | 1 | email | A | 25 | NULL | NULL | YES | BTREE | | | | uv_user | 0 | UNIQ_E8D39F61DB26A4E | 1 | proxy_id | A | 2 | NULL | NULL | YES | BTREE | | | | uv_user | 0 | UNIQ_E8D39F61E821C39F | 1 | verification_code | A | 25 | NULL | NULL | YES | BTREE | | | | uv_user | 0 | UNIQ_E8D39F613701B297 | 1 | timezone | A | 4 | NULL | NULL | YES | BTREE | | | | uv_user | 0 | UNIQ_E8D39F6111F07F3F | 1 | timeformat | A | 4 | NULL | NULL | YES | BTREE | | | +---------+------------+-----------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ 6 rows in set (0.00 sec)

drop index UNIQ_E8D39F6111F07F3F on uv_user; drop index UNIQ_E8D39F613701B297 on uv_user;

/vendor/uvdesk/core-framework/Entity/User.php


     /**
     * @var string
     * @ORM\Column(type="string", length=191, unique=true, nullable=true)
     */
    private $timezone;

    /**
     * @var string
     * @ORM\Column(type="string", length=191, unique=true, nullable=true)
     */
    private $timeformat;

    /**
     * Constructor
     */
    public function __construct()
papnoisanjeev commented 5 years ago

@alessioluciano

Thanks for reporting this issue. ORM definition with 'unique = true'. we will fix this issue soon.

For now you can remove this 'unique = true' from user entity and update database by below command: php bin/console d:s:u --force