custom_courses
What It Stores
When a user purchases a custom course, AI generates a personalized hypnotherapy course just for them. This table stores the complete course data as JSON — including audio file references, workbook content, scripts, and metadata.
Course code for custom courses is always X99ENB (or similar X-prefix codes).
When Rows Are Created
Created during the custom course generation flow:
- User purchases a custom course
submit-custom-coursetriggers script generation via n8n- Audio is generated and uploaded to Cloudflare R2
update_jsonupdates thedatacolumn with audio metadatacalculate_checksumcomputes the checksum and file size
Columns
| Column | Type | Required | Default | Description |
|---|---|---|---|---|
id |
uuid | Yes | auto-generated | Custom course ID. |
user_id |
uuid | Yes | — | Who owns this custom course. |
course_code |
text | Yes | — | Always something like X99ENB. |
title |
text | Yes | — | User-defined or AI-generated title. |
description |
text | Yes | — | Course description. |
data |
json | Yes | — | Full course JSON. Contains audio_files (URLs, checksums, durations), workbooks, scripts, and all metadata needed to render the course in the app. |
checksum |
text | Yes | — | MD5 of the data JSON. Used by handshake for sync comparison. |
file_size_bytes |
integer | Yes | — | Size of the JSON data in bytes. |
created_at |
timestamptz | Yes | now() |
When the course was created. |
updated_at |
timestamptz | Yes | now() |
Last update (e.g., when new audio is appended). |
Key Relationships
- auth.users —
user_id(course owner) - custom_course_purchases — child table tracking purchase info
Who Can Access
Server only — no RLS policy. Edge functions access with service-role key.
Used By These Edge Functions
handshake— includes custom courses in sync responsesubmit-custom-course— triggers the generation flowupdate_json— appends new audio entries todatacalculate_checksum— computes/updateschecksumandfile_size_bytesmanage-regen-requests— handles audio regeneration