Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(teams): unique domain index (#5086)

Will Hutchinson132a89419aa9
diff --git a/crates/macro_db_client/migrations/20260722164812_add_unique_team_auto_join_domain_index.sql b/crates/macro_db_client/migrations/20260722164812_add_unique_team_auto_join_domain_index.sql
new file mode 100644
index 0000000000..cf13d17dc0
--- /dev/null
+++ b/crates/macro_db_client/migrations/20260722164812_add_unique_team_auto_join_domain_index.sql
@@ -0,0 +1,7 @@
+-- Replace the existing lookup index with a unique partial index so that a
+-- non-null auto-join domain can belong to at most one team.
+DROP INDEX team_auto_join_domain_idx;
+
+CREATE UNIQUE INDEX team_auto_join_domain_idx
+ ON team (auto_join_domain)
+ WHERE auto_join_domain IS NOT NULL;