Files
aiworker-backend/drizzle/migrations/0002_next_xorn.sql
Hector Ros 8382f6645e
All checks were successful
Build and Push Backend / build (push) Successful in 5s
Implement multi-user auth + agent management + terminal proxy
- Add userId to agents and projects tables (with migrations)
- Create auth middleware for session validation
- Protect MCP endpoints with authentication and user filtering
- Implement agent management API (launch, my, delete)
- Add terminal proxy at /agent-terminal/:agentId with auth
- Update all agent endpoints to verify user ownership

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-20 17:21:53 +01:00

6 lines
651 B
SQL

ALTER TABLE `agents` ADD `user_id` varchar(36) NOT NULL;--> statement-breakpoint
ALTER TABLE `projects` ADD `user_id` varchar(36) NOT NULL;--> statement-breakpoint
ALTER TABLE `agents` ADD CONSTRAINT `agents_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `projects` ADD CONSTRAINT `projects_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX `idx_user_id` ON `agents` (`user_id`);--> statement-breakpoint
CREATE INDEX `idx_user_id` ON `projects` (`user_id`);