-- Also adds denormalized count columns on team_tasks for dashboard performance. -- 1. Drop old attachments (FK → team_workspace_files) DROP TABLE IF EXISTS team_task_attachments; -- 2. Drop workspace ...
-- 2. Backfill: create teams rows from existing team_members.owner_id -- 3. Add team_id to team_members + team_invitations, backfill, drop owner_id created_at timestamptz NOT NULL DEFAULT now(), ...