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.

feat(db): add foreign entity table (#3546)

Will Hutchinson227f4ba262d4
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260526175912_create_foreign_entity_table.sql b/rust/cloud-storage/macro_db_client/migrations/20260526175912_create_foreign_entity_table.sql
new file mode 100644
index 0000000000..d0bf7ddcd0
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260526175912_create_foreign_entity_table.sql
@@ -0,0 +1,17 @@
+CREATE TABLE IF NOT EXISTS foreign_entity
+(
+ id UUID PRIMARY KEY NOT NULL,
+ foreign_entity_id TEXT NOT NULL,
+ foreign_entity_source TEXT NOT NULL,
+ metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
+ stored_for_id TEXT NOT NULL,
+ stored_for_auth_entity TEXT NOT NULL,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
+);
+
+CREATE INDEX IF NOT EXISTS idx_foreign_entity_foreign_entity_id_source
+ ON foreign_entity (foreign_entity_id, foreign_entity_source);
+
+CREATE INDEX IF NOT EXISTS idx_foreign_entity_stored_for_id_auth_entity
+ ON foreign_entity (stored_for_id, stored_for_auth_entity);