opensolutions / ViMbAdmin

Virtual Mailbox Administration
http://www.vimbadmin.net/
GNU General Public License v3.0
485 stars 101 forks source link

Database column `mailbox`.`username` is not unique #289

Closed PhrozenByte closed 1 year ago

PhrozenByte commented 2 years ago

mailbox.username currently isn't required to be unique in the database (uniqueness is currently only enforced by code), nor is the column even indexed. Querying the ViMbAdmin database using mailbox.username as (supposed to be unique) identifier is one of the main database queries any mail server software (Dovecot, Postfix, etc.) performs frequently (up to thousands of queries a day, depending on the number of users). mailbox.local_part should be indexed, too.

barryo commented 1 year ago

Good catch. Fixed in 5836ad571a5017351605a341c1a3c5c02e348e3c and can be updated via:

# sanity check the output of:
./bin/doctrine2-cli.php orm:schema-tool:update --dump-sql

# and then run:
./bin/doctrine2-cli.php orm:schema-tool:update --force