ActivityFox Dev

Supabase Schema

Table definitions, column types, RLS policies, and data flow for the Supabase database backing ActivityFox.

Supabase Schema

ActivityFox uses Supabase Cloud as the source of truth for activities, sessions, child preferences, and vendor signups. Sharetribe handles users, listings (one per published session), and transactions.

Tables

activities

The program a vendor offers. One activity can have many sessions.

ColumnTypeNotes
iduuid PKgen_random_uuid()
vendor_idtext NOT NULLSharetribe user ID
titletext NOT NULL
descriptiontext
categorytext NOT NULLOne of the 10 canonical categories
subcategorytext
location_addresstext
location_latdecimal
location_lngdecimal
age_group_minint
age_group_maxint
image_urlsjsonbDefault '[]'
statustextdraft, published, archived. Default draft
created_attimestamptzDefault now()
updated_attimestamptzDefault now()

sessions

A specific scheduled offering of an activity. Each published session creates a Sharetribe listing.

ColumnTypeNotes
iduuid PKgen_random_uuid()
activity_iduuid FKReferences activities(id) ON DELETE CASCADE
listing_idtextSharetribe listing ID (set on publish)
labeltext NOT NULLe.g. "Term 1 Mon/Wed 3-5pm"
start_datedate NOT NULL
end_datedate NOT NULL
days_of_weektext[] NOT NULLe.g. {'MO','WE'}
start_timetime NOT NULL
end_timetime NOT NULL
total_seatsint NOT NULL
seats_remainingint NOT NULL
price_sub_unitsint NOT NULLPrice in cents
currencytextDefault 'AUD'
caldav_calendar_idtextDavis calendar path (set on publish)
statustextdraft, published, cancelled, completed. Default draft
refund_full_daysintFull refund if cancelled >X days before. Default 7
refund_partial_daysintPartial refund if cancelled >Y days before. Default 3
refund_partial_pctintPartial refund percentage. Default 50
created_attimestamptzDefault now()
updated_attimestamptzDefault now()

child_likes

Per-child activity favourites.

ColumnTypeNotes
iduuid PKgen_random_uuid()
child_idtext NOT NULLSharetribe child user ID
activity_iduuid FKReferences activities(id) ON DELETE CASCADE
created_attimestamptzDefault now()

UNIQUE constraint on (child_id, activity_id).

child_connections

Same-family child relationships.

ColumnTypeNotes
iduuid PKgen_random_uuid()
child_idtext NOT NULL
connected_child_idtext NOT NULL
relationshiptext NOT NULLtwin, sibling, close-friend, friend, classmate
scoreint NOT NULLtwin=10, sibling=9, close-friend=8, friend=6, classmate=4
created_attimestamptzDefault now()

UNIQUE constraint on (child_id, connected_child_id). Connections are stored bidirectionally (both rows inserted in a single transaction).

child_interests

Per-child category interests.

ColumnTypeNotes
iduuid PKgen_random_uuid()
child_idtext NOT NULL
categorytext NOT NULLOne of the 10 canonical categories
created_attimestamptzDefault now()

UNIQUE constraint on (child_id, category).

expressions_of_interest

Lightweight commitment tracking. Supplements Sharetribe EOI transactions.

ColumnTypeNotes
iduuid PKgen_random_uuid()
session_iduuid FKReferences sessions(id) ON DELETE CASCADE
child_idtext NOT NULL
parent_idtext NOT NULLSharetribe parent user ID
transaction_idtextSharetribe EOI transaction ID
statustextexpressed, confirmed, withdrawn, declined. Default expressed
created_attimestamptzDefault now()
updated_attimestamptzDefault now()

UNIQUE constraint on (session_id, child_id).

vendor_signups

Vendor interest form submissions from /for-providers.

ColumnTypeNotes
iduuid PKgen_random_uuid()
org_nametext NOT NULL
contact_nametext NOT NULL
emailtext NOT NULL
phonetext
program_typestext[] NOT NULLArray of category slugs
websitetext
referral_sourcetext
notestext
statustextDefault 'new'
created_attimestamptzDefault now()

Migration

The migration SQL is at server/scripts/supabase-migration.sql. Run it against the Supabase SQL editor or via psql.

Data Flow

Vendor creates Activity (Supabase)
  └─ creates Sessions (Supabase)
       └─ on publish:
            ├─ creates Sharetribe listing (for transactions/payments)
            ├─ creates CalDAV calendar (for date management)
            └─ indexes to Meilisearch (for search)

Supabase is the source of truth. Sharetribe listings, CalDAV calendars, and Meilisearch indexes are derived from Supabase data.

On this page