fix email issues, add company,project,todos

This commit is contained in:
richardtekula
2025-11-21 13:56:02 +01:00
parent bb851639b8
commit ca93b6f2d2
30 changed files with 4860 additions and 1066 deletions

View File

@@ -0,0 +1,21 @@
-- Migration: Add project_users junction table for project team management
-- Created: 2025-11-21
-- Description: Allows many-to-many relationship between projects and users
-- Create project_users junction table
CREATE TABLE IF NOT EXISTS project_users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
role TEXT,
added_by UUID REFERENCES users(id) ON DELETE SET NULL,
added_at TIMESTAMP NOT NULL DEFAULT NOW(),
CONSTRAINT project_user_unique UNIQUE(project_id, user_id)
);
-- Create indexes for better query performance
CREATE INDEX IF NOT EXISTS idx_project_users_project_id ON project_users(project_id);
CREATE INDEX IF NOT EXISTS idx_project_users_user_id ON project_users(user_id);
-- Add comment
COMMENT ON TABLE project_users IS 'Junction table for many-to-many relationship between projects and users (project team members)';