On 31 July 2021 9.12.53 UTC, Joseph D Wagner <joe@josephdwagner.info> wrote:
I've seen documentation on using a SQL backend for quota dictionary and passdb&userdb dictionary. However, I can't find any examples of a SQL backend for IMAP METADATA / mail_attributes_dict.
Is this combination possible? If so, is there an example somewhere?
I am unsure what data structures it's expected or how to create the map entries for it.
Thanks in advance.
Joseph D. Wagner
Hi Joseph,
try
mail_attributes_dict = proxy::attr
dict { attr = sql:/path/to/config }
map { pattern = /shared/$key table = attr_shared fields { attr_name = $key } value_field = attr_value }
map { pattern = /priv/$key table = attr_priv fields { attr_name = $key } username_field = username value_field = attr_value }
SQL
CREATE TABLE attr_shared ( attr_name VARCHAR(255) PRIMARY KEY NOT NULL, attr_value VARCHAR(65535) )
CREATE TABLE attr_priv ( attr_name VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, attr_value VARCHAR(65535) PRIMARY KEY(attr_name, username) )
Hopefully correct :)
Aki