compassmock/drizzle/0028_small_old_lace.sql
Nicholai 7ee5304176 feat(auth): add organization invite links
Shareable invite codes (e.g. hps-k7m2x9) let anyone
join an org after authenticating. Admins create/revoke
links from Settings > Team. Public /join/[code] route
handles acceptance with expiry and max-use limits.
2026-02-16 20:08:07 -07:00

34 lines
1.2 KiB
SQL

CREATE TABLE `organization_invites` (
`id` text PRIMARY KEY NOT NULL,
`organization_id` text NOT NULL,
`code` text NOT NULL,
`role` text DEFAULT 'office' NOT NULL,
`max_uses` integer,
`use_count` integer DEFAULT 0 NOT NULL,
`expires_at` text,
`created_by` text NOT NULL,
`is_active` integer DEFAULT true NOT NULL,
`created_at` text NOT NULL,
FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `organization_invites_code_unique` ON `organization_invites` (`code`);--> statement-breakpoint
CREATE TABLE `mcp_servers` (
`id` text PRIMARY KEY NOT NULL,
`org_id` text NOT NULL,
`name` text NOT NULL,
`slug` text NOT NULL,
`transport` text NOT NULL,
`command` text,
`args` text,
`env` text,
`url` text,
`headers` text,
`is_enabled` integer DEFAULT true NOT NULL,
`created_at` text NOT NULL,
`created_by` text NOT NULL,
FOREIGN KEY (`org_id`) REFERENCES `organizations`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);