Ai-Mee Help Centre
Home
Features
How-To Guides
FAQ
Need Help?
Home
Features
How-To Guides
FAQ
Need Help?

Step 1 — Drop customer_posts.scheduled Column

Prerequisites: None
Risk: Irreversible data drop — confirm there is no auto-publisher or external consumer reading customer_posts.scheduled before applying.


What This Does

Removes the scheduled column from the customer_posts table. Scheduling moves entirely to customer_platform_post.scheduled_at (already present in the schema).


1.1 — Create the Migration File

Create the file front-end/supabase/migrations/<timestamp>_drop_customer_posts_scheduled.sql.

Get the timestamp: date -u +%Y%m%d%H%M%S

-- Migration: drop customer_posts.scheduled
-- Scheduling is now handled exclusively via customer_platform_post.scheduled_at

ALTER TABLE public.customer_posts
  DROP COLUMN IF EXISTS scheduled;

1.2 — Apply the Migration

# From the front-end/ directory:
cd front-end

# Apply to local Supabase instance only (NEVER use db push):
pnpm supabase db reset

⚠️ Never run supabase db push — this targets the remote/production database. All migrations must be applied locally via pnpm supabase db reset.


1.3 — Verify

In Supabase Studio → Table Editor → customer_posts: confirm the scheduled column is gone.

Or via psql:

SELECT column_name
FROM information_schema.columns
WHERE table_schema = 'public'
  AND table_name = 'customer_posts'
  AND column_name = 'scheduled';
-- Should return 0 rows

Also confirm customer_platform_post.scheduled_at still exists:

SELECT column_name, data_type
FROM information_schema.columns
WHERE table_schema = 'public'
  AND table_name = 'customer_platform_post'
  AND column_name = 'scheduled_at';
-- Should return 1 row: scheduled_at | timestamp with time zone

✅ Done

Proceed to Step 2 — Posts Service.