0029_marketing_events.sql24 lines · main
1-- 0029_marketing_events — minimal funnel tracking for /migrate.
2--
3-- Records two event types:
4-- migrate_view — fired when /migrate/<source> renders
5-- migrate_lead_submitted — fired when POST /v1/migration-leads succeeds
6--
7-- Source values: convex | supabase | firebase | mongodb | drizzle |
8-- prisma | postgres | hasura | nextauth | other | hub (the /migrate
9-- index page itself).
10--
11-- No PII; ip_hash optional for future dedup-by-visitor logic. Customer
12-- emails are recorded only in migration_requests (the actual lead).
13
14CREATE TABLE IF NOT EXISTS "marketing_events" (
15 "id" text PRIMARY KEY NOT NULL,
16 "event_type" text NOT NULL,
17 "source" text NOT NULL,
18 "ip_hash" text,
19 "user_agent" text,
20 "created_at" timestamp with time zone DEFAULT now() NOT NULL
21);
22
23CREATE INDEX IF NOT EXISTS "marketing_events_lookup_idx"
24 ON "marketing_events" USING btree ("source", "event_type", "created_at" DESC);