# Clear Stakeholders Data in Supabase

Use these queries in **Supabase → SQL Editor** when you need to remove old or stale stakeholders from project rows (e.g. so the share page shows no stakeholders for projects that have none in the app).

---

## 1. Preview: see which projects have non-empty stakeholders

```sql
SELECT id, name, stakeholders
FROM public.projects
WHERE stakeholders IS NOT NULL
  AND stakeholders != '[]'::JSONB;
```

---

## 2. Clear stakeholders for all projects

```sql
UPDATE public.projects
SET stakeholders = '[]'::JSONB,
    updated_at = NOW()
WHERE stakeholders IS DISTINCT FROM '[]'::JSONB;
```

---

## 3. Clear stakeholders for one project (by name)

```sql
UPDATE public.projects
SET stakeholders = '[]'::JSONB,
    updated_at = NOW()
WHERE name = 'Your Project Name'
  AND (stakeholders IS NOT NULL AND stakeholders != '[]'::JSONB);
```

---

## 4. Clear stakeholders for one project (by id)

```sql
UPDATE public.projects
SET stakeholders = '[]'::JSONB,
    updated_at = NOW()
WHERE id = 'your-project-uuid-here'
  AND (stakeholders IS NOT NULL AND stakeholders != '[]'::JSONB);
```

---

**Tip:** Run the preview query first, then run the update that matches what you want (all projects or a single project).
