I have seen these feature requests (with multiple “likes”), and I also would like this feature myself, so I am planning to try to implement it:
https:// community.zammad. org/t/organisations-with-multiple-domains/377
(That thread also includes links to other issues that it seems I cannot access.)
https:// community.zammad. org/t/organisations-multiple-domains/1783
Before I get started writing code, I can think of several possible ways to implement this, and I would appreciate input about which of these makes the most sense, since they all have pros and cons.
-
Allow comma-separated values in the existing
domains
field
Pros: No database changes
Cons: Requires usingLIKE
for lookup queries, which is probably inefficient; unstructured; requires manual query for uniqueness. -
Change the
domains
field to a PostgreSQL array (TEXT[]
)
Pros: Can be indexed; Can be converted from existing text field; Zammad is moving to require PostgreSQL in 7.0+ anyway
Cons: Requires a manual check or an extra table and a trigger for uniqueness; Cannot be released in Zammad 6.x because it relies on PostgreSQL. -
Add an additional field for
other_domains
(either comma-separated like #1 or an array like #2)
Pros: Most organizations with only one domain will keep the existing easy code path of looking up a single domain, and we will only fall back to theother_domains
field if the initialdomain
lookup returns no result
Cons: Requires additional documentation aboutother_domains
not being checked for duplicates, and not overridingdomain
from a different organization, or requires manual implementation of duplicate checks -
Add a separate table for
domains
, with a foreign key to organizations
Pros: The cleanest way to implement in the database itself
Cons: Requires the most code changes, including migration of the existingdomain
field to the new table, and design changes to the organization editing screen to allow multiple fields.
I’m inclined to do option #3+#1 – additional field stored comma-separated – because that is probably the least work to get a reasonable result, but I’m curious if anyone has any input before I actually start working on it.