# Phase 0 — Columns / Pivots / Relations to Drop

**Purpose:** explicit list of every DB column, pivot table, and JSON relation that will be permanently removed by the Monday-sync refactor. Each entry cites the Monday column ID it currently maps from, the DB column it lives in, and every code consumer that reads/writes it. **No destructive migration will run until you sign off on this list.**

Legend:
- ✅ — safe to drop, no consumer references it (or only mapper writes it)
- ⚠️ — has consumer reference(s); listed under "Consumers to update"

---

## 1. Investors — DB columns to drop

| DB column | Monday column ID | Source (mapper line) | Why dropping | Safety |
|-----------|------------------|----------------------|--------------|--------|
| `solvency_option_id` | `status_mkktksgv` | [InvestorItemMapper.php:46](app/Services/Monday/InvestorItemMapper.php#L46) | Not in new spec | ⚠️ Model fillable + relation method |
| `tier_option_id` | `status_mkm14zqd` | [InvestorItemMapper.php:55](app/Services/Monday/InvestorItemMapper.php#L55) | Not in new spec | ⚠️ Model fillable + relation method + show.blade |
| `previous_investments_count` | `numeric_mkkxqr35` | [InvestorItemMapper.php:61](app/Services/Monday/InvestorItemMapper.php#L61) | Replaced by `previous_investments_details` (text) | ⚠️ Model fillable + cast + show.blade + form req + signup ctrl |
| `ticket_size_sar` | `numbers_mkkxqdhk` | [InvestorItemMapper.php:64](app/Services/Monday/InvestorItemMapper.php#L64) | Not in new spec | ⚠️ Model fillable + cast + show.blade + index sort + controller |
| `total_investment_sar` | `numbers__1` | [InvestorItemMapper.php:65](app/Services/Monday/InvestorItemMapper.php#L65) | Not in new spec | ⚠️ Model fillable + cast + show.blade |
| `full_en_name` | `text_mkmqjy0j` | [InvestorItemMapper.php:71](app/Services/Monday/InvestorItemMapper.php#L71) | Not in new spec; `name` and `first_name`+`last_name` cover identity | ⚠️ Model fillable + index search |
| `monday_wishlist_ids` (JSON) | `connect_boards` | [InvestorItemMapper.php:84](app/Services/Monday/InvestorItemMapper.php#L84) | Board-relation IDs not in new spec; replaced by `wishlist_value` formula | ⚠️ Model fillable + cast |
| `monday_portfolio_ids` (JSON) | `connect_boards4` | [InvestorItemMapper.php:85](app/Services/Monday/InvestorItemMapper.php#L85) | Same | ⚠️ Model fillable + cast |
| `monday_mentor_ids` (JSON) | `connect_boards8` | [InvestorItemMapper.php:86](app/Services/Monday/InvestorItemMapper.php#L86) | Same | ⚠️ Model fillable + cast |

## 2. Investors — Pivot tables to drop

| Pivot table | What it stored | Why dropping |
|-------------|----------------|--------------|
| `methods` (table) + `InvestorMethod` model | Multi-value pivot for `dropdown_mksekwvt` | New spec treats `dropdown_mksekwvt` as a SINGLE field `payment_method` (string). Pivot collapses into a column. ⚠️ See open question in `columns-to-rename.md` about whether this is multi-select on Monday's side — if it is, keep as JSON array. |

## 3. Startups — DB columns to drop

| DB column | Monday column ID | Source (mapper line) | Why dropping | Safety |
|-----------|------------------|----------------------|--------------|--------|
| `previous_round_count` | `numeric_mkt2nac9` | [StartupItemMapper.php:59](app/Services/Monday/StartupItemMapper.php#L59) | Not in new spec | ⚠️ Model fillable + cast + show.blade + form req |
| `follow_up_notes` | `long_text__1` | [StartupItemMapper.php:78](app/Services/Monday/StartupItemMapper.php#L78) | Not in new spec | ⚠️ Model fillable + show.blade |
| `event_date_text` | `text_mkn4skp6` | [StartupItemMapper.php:79](app/Services/Monday/StartupItemMapper.php#L79) | Not in new spec | ✅ Mapper-only |
| `event_hour` | `hour_mkn44971` | [StartupItemMapper.php:168](app/Services/Monday/StartupItemMapper.php#L168) | Not in new spec | ✅ Mapper-only |
| `event_link` | `link_mkn4npbg` | [StartupItemMapper.php:89](app/Services/Monday/StartupItemMapper.php#L89) | Not in new spec | ✅ Mapper-only |
| `monday_investor_ids` (JSON) | `link_to_investors` | [StartupItemMapper.php:94](app/Services/Monday/StartupItemMapper.php#L94) | Board-relation IDs not in new spec | ⚠️ Model fillable + cast |
| `monday_deal_ids` (JSON) | `connect_boards2` | [StartupItemMapper.php:95](app/Services/Monday/StartupItemMapper.php#L95) | Same | ⚠️ Model fillable + cast |
| `monday_demo_ids` (JSON) | `link_to_demo_mkksgxhf` | [StartupItemMapper.php:96](app/Services/Monday/StartupItemMapper.php#L96) | Same | ⚠️ Model fillable + cast |
| `monday_nominated_ids` (JSON) | `board_relation_mknxhy64` | [StartupItemMapper.php:97](app/Services/Monday/StartupItemMapper.php#L97) | Same | ⚠️ Model fillable + cast |

## 4. Startups — File slot to drop

| Slot | Monday column ID | Why | Safety |
|------|------------------|-----|--------|
| `video` | `files7` | Not in new spec (spec only lists `files1`→logo, `files8`→pitch_deck, `files_1`→other) | ✅ [StartupItemMapper.php:104](app/Services/Monday/StartupItemMapper.php#L104) only |

Existing `files` rows with `source_column_id='files7'` will be ORPHANED. Plan: the Phase 4 re-download command will leave them in place but mark them as deprecated; a follow-up cleanup task can prune.

## 5. Subitem (startup members) — column to drop

| Subitem column | Monday column ID | Source (mapper line) | Why |
|----------------|------------------|----------------------|-----|
| `nationality_text` | `nationality__1` | [StartupItemMapper.php:113](app/Services/Monday/StartupItemMapper.php#L113) | Spec maps subitem `nationality` (no `__1` suffix) to a label FK (`nationality_option_id`), not free text |

The free-text `nationality_text` field on `startup_members` should be dropped and replaced by a `nationality_option_id` FK → `label_options`. Confirm in `columns-to-rename.md`.

## 6. Synthetic "group" Label + LabelOptions (introduced by 2026_05_10_120000 migration)

These were a temporary measure inside `label_options` to give startups/investors a `group_id` FK without modifying the legacy `groups` table. The refactor moves `group_id` to point at the real `groups` table instead.

To drop after `group_id` is re-pointed:
- `Label` rows where `(type, key) IN (('startup','group'),('investor','group'))`
- All their `LabelOption` rows (one per distinct monday_group_id for startups + 4 canonical for investors)

⚠️ Their IDs are currently FK-referenced by `startups.group_id` and `investors.group_id`. The re-point migration handles the dependency: rebuild `group_id` against the new `groups` table, then drop the synthetic labels.

---

## Consumers to update for each dropped column

For every ⚠️ entry above, this is the exact set of files that must change in Phase 5:

### `solvency_option_id`
- [app/Models/Investor.php:39](app/Models/Investor.php#L39) (fillable) and [:89](app/Models/Investor.php#L89) (relation `solvency()`)
- [resources/views/admin/investors/show.blade.php](resources/views/admin/investors/show.blade.php) — search "solvency"
- [app/Http/Controllers/Admin/InvestorController.php](app/Http/Controllers/Admin/InvestorController.php) (EDITABLE_LABEL_FIELDS whitelist)

### `tier_option_id`
- [app/Models/Investor.php:44](app/Models/Investor.php#L44) (fillable) and [:98](app/Models/Investor.php#L98) (relation `tier()`)
- [resources/views/admin/investors/show.blade.php](resources/views/admin/investors/show.blade.php) — search "tier"
- [app/Http/Controllers/Admin/InvestorController.php](app/Http/Controllers/Admin/InvestorController.php) (EDITABLE_LABEL_FIELDS whitelist)

### `previous_investments_count`
- [app/Models/Investor.php:33](app/Models/Investor.php#L33) (fillable) and [:70](app/Models/Investor.php#L70) (cast)
- [app/Http/Requests/Web/InvestorSignupRequest.php](app/Http/Requests/Web/InvestorSignupRequest.php) — currently validated (conditional on has_angel_invested)
- [app/Http/Controllers/Web/InvestorSignupController.php](app/Http/Controllers/Web/InvestorSignupController.php) — persists this on signup
- [resources/views/web/signup/investor-signup.blade.php](resources/views/web/signup/investor-signup.blade.php) — input field — **per user rule we keep the input but stop persisting** OR repurpose it to write to `previous_investments_details` (text). See open question in rename doc.
- [resources/views/admin/investors/show.blade.php](resources/views/admin/investors/show.blade.php)

### `ticket_size_sar`
- [app/Models/Investor.php:35](app/Models/Investor.php#L35) (fillable) and [:73](app/Models/Investor.php#L73) (cast)
- [app/Http/Controllers/Admin/InvestorController.php](app/Http/Controllers/Admin/InvestorController.php) — sort key
- [resources/views/admin/investors/show.blade.php](resources/views/admin/investors/show.blade.php)

### `total_investment_sar`
- [app/Models/Investor.php:35](app/Models/Investor.php#L35) (fillable) and [:74](app/Models/Investor.php#L74) (cast)
- [resources/views/admin/investors/show.blade.php](resources/views/admin/investors/show.blade.php)

### `full_en_name`
- [app/Models/Investor.php:29](app/Models/Investor.php#L29) (fillable)
- [app/Http/Controllers/Admin/InvestorController.php](app/Http/Controllers/Admin/InvestorController.php) — index search query
- [app/Services/Templates/TemplateContext.php](app/Services/Templates/TemplateContext.php) — verify usage
- [lang/{ar,en}/admin.php](lang/en/admin.php) — UI label

### `monday_{wishlist,portfolio,mentor}_ids`
- [app/Models/Investor.php:48](app/Models/Investor.php#L48) (fillable) and [:75-77](app/Models/Investor.php#L75) (casts)
- No view/controller usage detected — clean drop after model update

### `previous_round_count`
- [app/Models/Startup.php:43](app/Models/Startup.php#L43) (fillable) and [:82](app/Models/Startup.php#L82) (cast)
- [app/Http/Requests/Web/StartupSignupRequest.php](app/Http/Requests/Web/StartupSignupRequest.php) — validated
- [app/Http/Controllers/Web/StartupSignupController.php](app/Http/Controllers/Web/StartupSignupController.php) — persists on signup
- [resources/views/web/signup/startup_signup.blade.php](resources/views/web/signup/startup_signup.blade.php) — input — **per user rule keep input, stop persisting**
- [resources/views/admin/startups/show.blade.php](resources/views/admin/startups/show.blade.php)

### `follow_up_notes`
- [app/Models/Startup.php:33](app/Models/Startup.php#L33) (fillable)
- [resources/views/admin/startups/show.blade.php](resources/views/admin/startups/show.blade.php)

### `monday_{investor,deal,demo,nominated}_ids`
- [app/Models/Startup.php:52-53](app/Models/Startup.php#L52) (fillable) and [:84-87](app/Models/Startup.php#L84) (casts)
- No view/controller usage detected — clean drop after model update

---

## What is NOT being dropped (preserved verbatim)

The following are CURRENTLY in the schema and stay in place because they appear in your new spec OR they are infrastructure (sync metadata, audit) the new spec implicitly relies on:

**Investors:** `monday_item_id`, `monday_group_id`, `monday_group_title`, `monday_last_updated_at`, `monday_created_at`, `last_synced_at`, `name`, `first_name`, `last_name`, `email`, `phone_number`, `is_active`, `source`, `accepted_privacy_policy*`, `joining_date`, `investments_count`, `expected_yearly_investment_sar` (renamed), `investment_cap_sar`, all label FKs not listed above for drop, `group_id` (re-pointed in Phase 2.2).

**Startups:** same sync metadata; `name`, `full_name`, `email`, `phone_number`, `website`, `linkedin_url`, `ios_url`, `android_url`, all numerics not listed for drop, `kpi_with_funding` (renamed), `compelling_factors` (renamed), `company_brief` (renamed), `valuation_sar` (renamed), `valuation_formula` (renamed), all remaining label FKs (renames in rename doc), `is_active`, `source`, `accepted_privacy_policy*`, `group_id`.

---

## Open questions on this drop list

1. **`previous_investments_count` (investor)** — the new spec adds `previous_investments_details` (text, from `text4`) but drops the numeric count. The signup form currently asks for a numeric count (input `name="previous_investments_count"`, conditional on `has_angel_invested_option_id == 'yes'`). Options:
   - **A.** Drop the count column, repurpose the form input to write to `previous_investments_details` (will require changing input type from numeric to text in form UI — but per user rule, form inputs must NOT be removed/hidden).
   - **B.** Keep the count column AND add the details column. Form keeps writing count; Monday sync only writes details.
   - **C.** Drop the count column, keep the form input rendered, but stop persisting it (silent no-op). Cleanest preservation of UI; loses past-data continuity.

2. **`methods` pivot → `payment_method` column** — Monday's `dropdown_mksekwvt` may be a multi-select dropdown. Confirm: is `payment_method` actually single-value, or did the spec mean a multi-value list? If multi, keep as a JSON array column (NOT a pivot).

3. **Synthetic group labels** — once `group_id` re-points to the real `groups` table, do you want me to soft-delete or hard-delete the synthetic `Label` rows (`type IN ('startup','investor'), key='group'`) and their options? Soft-delete is safer.

4. **`files7` → `video` slot** — drop the slot, but what about existing video files already downloaded for some startups? Leave on disk (orphaned, harmless), delete with manual cleanup, or include in re-download command? Recommend: leave on disk.
