Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
INSERT INTO public."Organization" ("id", "name")
VALUES (1, 'test-org');
-- Three users (UA, UB, UC)
INSERT INTO public."macro_user" ("id", "username", "email", "stripe_customer_id") VALUES
('a1111111-1111-1111-1111-111111111111', 'user_a', '[email protected]', 'stripe_a'),
('a2222222-2222-2222-2222-222222222222', 'user_b', '[email protected]', 'stripe_b'),
('a3333333-3333-3333-3333-333333333333', 'user_c', '[email protected]', 'stripe_c');
INSERT INTO public."User" ("id", "email", "stripeCustomerId", "organizationId", "macro_user_id") VALUES
('macro|[email protected]', '[email protected]', 'stripe_a', 1, 'a1111111-1111-1111-1111-111111111111'),
('macro|[email protected]', '[email protected]', 'stripe_b', 1, 'a2222222-2222-2222-2222-222222222222'),
('macro|[email protected]', '[email protected]', 'stripe_c', 1, 'a3333333-3333-3333-3333-333333333333');
-- PROJECT_A (root, owner UA)
INSERT INTO public."Project" ("id", "name", "userId")
VALUES ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'project-a', 'macro|[email protected]');
-- PROJECT_B (child of A, owner UB)
INSERT INTO public."Project" ("id", "name", "userId", "parentId")
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'project-b', 'macro|[email protected]', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
-- PROJECT_C (child of B, owner UC)
INSERT INTO public."Project" ("id", "name", "userId", "parentId")
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project-c', 'macro|[email protected]', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb');
-- Documents: one in project_a, one in project_c
INSERT INTO public."Document" ("id", "name", "owner", "projectId")
VALUES ('doc-in-a', 'doc-a', 'macro|[email protected]', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
INSERT INTO public."Document" ("id", "name", "owner", "projectId")
VALUES ('doc-in-c', 'doc-c', 'macro|[email protected]', 'cccccccc-cccc-cccc-cccc-cccccccccccc');
-- Chats: one in project_b
INSERT INTO public."Chat" ("id", "name", "userId", "projectId")
VALUES ('chat-in-b', 'chat-b', 'macro|[email protected]', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb');
-- Direct owner records (granted_from_project_id IS NULL)
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level)
VALUES ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'project', 'macro|[email protected]', 'user', 'owner');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level)
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'project', 'macro|[email protected]', 'user', 'owner');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level)
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project', 'macro|[email protected]', 'user', 'owner');
-- Inherited owner records (should be excluded by query)
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level, granted_from_project_id)
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'project', 'macro|[email protected]', 'user', 'owner', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level, granted_from_project_id)
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project', 'macro|[email protected]', 'user', 'owner', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level, granted_from_project_id)
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project', 'macro|[email protected]', 'user', 'owner', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb');
-- Direct channel/team shares (granted_from_project_id IS NULL)
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level)
VALUES ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'project', 'channel-1', 'channel', 'view');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level)
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'project', 'team-1', 'team', 'edit');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level)
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project', 'channel-2', 'channel', 'comment');
-- Inherited channel/team shares (should be excluded by query)
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level, granted_from_project_id)
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'project', 'channel-1', 'channel', 'view', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level, granted_from_project_id)
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project', 'channel-1', 'channel', 'view', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa');
INSERT INTO entity_access (entity_id, entity_type, source_id, source_type, access_level, granted_from_project_id)
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', 'project', 'team-1', 'team', 'edit', 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb');