CREATE TABLE IF NOT EXISTS `user_project_permissions` (
  `id` varchar(50) NOT NULL PRIMARY KEY,
  `user_id` varchar(50) NOT NULL,
  `project_id` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE,
  FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE
);
--> statement-breakpoint
CREATE INDEX `idx_upp_user` ON `user_project_permissions` (`user_id`);
--> statement-breakpoint
CREATE INDEX `idx_upp_project` ON `user_project_permissions` (`project_id`);
--> statement-breakpoint
CREATE UNIQUE INDEX `uniq_upp_user_project` ON `user_project_permissions` (`user_id`, `project_id`);
