-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup-migration.sql
More file actions
26 lines (22 loc) · 1.31 KB
/
Copy pathcleanup-migration.sql
File metadata and controls
26 lines (22 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- ============================================================
-- CLEANUP: Drop truly unused columns (safe — code uses none of these)
-- ============================================================
-- Run this in Supabase SQL Editor.
-- Each statement uses IF EXISTS so it's safe to run multiple times.
-- ============================================================
-- WARNING: Do NOT add columns here unless you are 100% certain the
-- codebase never reads or writes them. Verify with:
-- grep -r "columnName" src/ --include="*.{ts,tsx}"
-- ============================================================
-- Categories (parent_id was never read in TypeScript code)
ALTER TABLE categories DROP COLUMN IF EXISTS parent_id;
ALTER TABLE categories DROP COLUMN IF EXISTS product_count;
ALTER TABLE categories DROP COLUMN IF EXISTS meta_title;
ALTER TABLE categories DROP COLUMN IF EXISTS meta_description;
-- Affiliate clicks (conversion tracking fields never used)
ALTER TABLE affiliate_clicks DROP COLUMN IF EXISTS converted;
ALTER TABLE affiliate_clicks DROP COLUMN IF EXISTS commission_estimate;
-- Site stats (updated_at column exists in some older versions but never used)
ALTER TABLE site_stats DROP COLUMN IF EXISTS updated_at;
-- Drop unused indexes (parent_id index on categories)
DROP INDEX IF EXISTS idx_categories_parent;