Fix SQL schema issues across all database engines

- Increase password column from varchar(64) to varchar(255) to
  prevent silent truncation of encrypted passwords
- Add missing UNIQUE constraint on iid in MySQL
- Add missing IX_ident_switch_iid index in PostgreSQL
- Remove deprecated int display width in MySQL (int(10) -> int)
- Fix trailing comma syntax error in SQLite 2018121800 migration
- Normalize indentation across all initial SQL files
- Add migration 2026021000 for all engines to fix existing installs
This commit is contained in:
Laurent Dinclaux
2026-02-10 10:35:20 +11:00
parent 958af7769f
commit 3c4d856d60
7 changed files with 113 additions and 31 deletions

View File

@@ -1,19 +1,20 @@
CREATE TABLE IF NOT EXISTS `ident_switch`
(
`id`
int(10) UNSIGNED
int UNSIGNED
NOT NULL
AUTO_INCREMENT,
`user_id`
int(10) UNSIGNED
int UNSIGNED
NOT NULL,
`iid`
int(10) UNSIGNED
NOT NULL,
int UNSIGNED
NOT NULL
UNIQUE,
`username`
varchar(64),
`password`
varchar(64),
varchar(255),
`imap_host`
varchar(64),
`imap_port`
@@ -33,9 +34,9 @@ CREATE TABLE IF NOT EXISTS `ident_switch`
int
CHECK(`smtp_port` > 0 AND `smtp_port` <= 65535),
`smtp_auth`
smallint
NOT NULL
DEFAULT 1,
smallint
NOT NULL
DEFAULT 1,
`drafts_mbox`
varchar(64),
`sent_mbox`
@@ -51,4 +52,3 @@ CREATE TABLE IF NOT EXISTS `ident_switch`
INDEX `IX_ident_switch_user_id`(`user_id`),
INDEX `IX_ident_switch_iid`(`iid`)
);