27 · Data model
D1 (SQLite) database wedding-planner. Every table has a text id primary key (UUID) unless noted, plus created_at / updated_at ISO timestamps. Money columns end _pence. Booleans are 0/1 integers.
Migrations are additive only (never alter or drop live columns). Live migrations are applied out-of-band and must also insert the matching d1_migrations row.
| Migration | Adds |
|---|---|
| 0001_init | settings, setup, tasks, budget_categories, budget_items, payments, households, guests, suppliers, decisions, tables, seating_assignments, logistics, run_sheet, contacts, packing_list, events, rsvp_imports |
| 0002_guest_portal | guest_qr_codes, rsvp_journeys, rsvp_questions, rsvp_answers, rsvp_event_windows, guest_tags, guest_tag_assignments; guests.access_code, rsvp_reminded_at, dietary_choice, song_request, tags_json |
| 0003_master_timeline | appointments; suppliers.deadline |
| 0004_email | email_campaigns, email_log |
| 0005_email_html | email_campaigns.body_html |
| 0006_seating_layout | tables.pos_x, pos_y |
| 0007_guest_site | events.guest_visible, start_time, end_time, guest_description |
| 0008_payment_invoice_link | payments.invoice_url, invoice_label |
| 0009_family_portal | payments.family_visible (default 1) |
| 0010_family_members | family_members |
| 0011_assistant | assistant_messages, assistant_pending |
| 0012_plus_ones | guests.plus_one_allowed, plus_one_response |
| 0013_guest_rsvp_message | guests.rsvp_message |
| 0014_assistant_chat | chat_conversations, chat_messages, chat_pending, chat_reads, push_subscriptions, chat_email_notices |
| 0015_ai_usage | ai_usage (+ backfill from assistant_messages and chat_messages) |
Planning tables
| Table | Columns |
|---|---|
setup (one row, id main) |
partner1_name, partner2_name, wedding_date, ceremony_venue, reception_venue, budget_ceiling (pence), contingency_percent (10), guest_target, priority_1–3, non_negotiable_1–3 |
tasks |
stage, order_index, title, description, guidance, owner (together), status (not_started), suggested_timing_weeks_before, suggested_deadline, agreed_deadline, effective_deadline, completed_at |
budget_categories |
name, order_index, allowance_pence, notes |
budget_items |
category_id → categories (cascade), name, supplier_id, estimate_pence, agreed_price_pence, forecast_pence, actual_pence, notes, order_index |
payments |
budget_item_id → items (cascade), type (instalment), due_date, amount_pence, paid_date, status (pending), reference, notes, invoice_url, invoice_label, family_visible |
suppliers |
category (other), name, contact_name, email, phone, website, address, quote_pence, inclusions, capacity, availability_confirmed, booking_status (researching), contract_link, questions_to_ask, notes, deadline |
decisions |
category, title, description, options (JSON list), chosen_option, inspiration_links (JSON list), decision_owner, deadline, decided_at, status (open), notes |
appointments |
title, date, time, location, notes |
events |
title, type, date, venue, description, guest_count, budget_link_id, tasks (JSON list), status (planning), notes, guest_visible, start_time, end_time, guest_description |
tables |
name, capacity (8), shape (round), location, notes, pos_x, pos_y |
seating_assignments |
table_id → tables (cascade), guest_id → guests (unique, cascade), seat_number |
logistics |
type, name, description, supplier_id, cost_pence, confirmed, details (JSON) |
run_sheet |
time, end_time, title, description, location, responsible_person (coordinator), supplier_id, is_critical, contingency_notes, order_index |
contacts |
name, role, phone, email, notes, is_emergency, order_index |
packing_list |
category, item, quantity (1), responsible_person, packed, notes, order_index |
Guest tables
| Table | Columns |
|---|---|
households |
name, address_line1, address_line2, city, postcode, country, notes |
guests |
household_id → households (set null), is_primary, first_name, last_name, email, phone, invitation_code, status (potential), attendance_type (none), dietary_needs, accessibility_requests, accommodation_needed/booked/details, gift_received, gift_description, thank_you_sent, thank_you_date, plus_one_of, notes (private), access_code, rsvp_reminded_at, dietary_choice, song_request, tags_json, plus_one_allowed, plus_one_response, rsvp_message |
guest_qr_codes (PK household_id) |
code (the household access code), qr_svg, qr_payload |
rsvp_journeys |
household_id, access_code_used, rsvp_started_at, rsvp_submitted_at, dietary_sent, travel_seen, details_seen, qr_scanned |
rsvp_questions / rsvp_answers |
question, field_type, options, required, order_index / guest_id, question_id, answer |
rsvp_event_windows |
event_key, label, opens_at, closes_at |
guest_tags / guest_tag_assignments |
name (unique), color (sage) / (guest_id, tag_id) PK |
rsvp_imports |
invitation_code, guest_name, attendance, dietary_needs, accessibility_requests, travel_requests, submitted_at, matched_guest_id, match_status, review_status, reviewed_at, reviewed_by, notes |
family_members |
email (unique, lower-case), label, created_at |
Email, assistant and chat tables
| Table | Columns |
|---|---|
email_campaigns |
kind (couple_reminder / guest_campaign / rsvp_reminder), subject, body, body_html, audience, household_id, recipient_count, status (sent / partial / failed), error, dry_run, sent_at |
email_log (id = provider message id or dry-*) |
campaign_id, to_email, to_name, subject, status, provider_id, error, sent_at |
assistant_messages |
kind, message_id, thread_id, from_email, subject, body_excerpt, mode, status, reason, reply_text, reply_message_id, actions, attempts, input/output_tokens, dry_run, processed_at |
assistant_pending (PK code) |
thread_id, tool, args, summary, status, resolved_at |
chat_conversations |
title, kind, source_ref, created_by, archived |
chat_messages |
conversation_id, role, author_email, text, status, reason, actions, attachments, questions, reply_to, input/output_tokens, dry_run |
chat_pending (PK code) |
conversation_id, message_id, tool, args, summary, status, result, resolved_by, resolved_at |
chat_reads (PK email + conversation) |
read_at |
push_subscriptions |
email, device_id, endpoint (unique), p256dh, auth, label, failures, last_success_at |
chat_email_notices (PK email + conversation) |
sent_at |
ai_usage |
source, ref (unique with source), model, actor_email, input_tokens, cache_write_tokens, cache_read_tokens, output_tokens |
The settings key/value table
Generic store (key, value, updated_at). Keys in use include:
| Key | Holds |
|---|---|
password_hash, auth_secret, password_temporary, temp_password_shared, login_fails, login_locked_until |
password sign-in |
guest_mode, teaser_live_at … thankyou_live_at, rsvp_open, rsvp_opens_at, rsvp_closes_at, go_public_date, preview_tokens, rsvp_reminder_log |
guest settings |
guest_site_draft, guest_site_published, guest_site_published_at, guest_site_views, meal options |
guest website |
code_guess:<hash> |
per-visitor code-guess counters |
mcp_tokens |
AI connector link hashes |
seed_tasks_done |
first-run seeding flag |
family_sync_status |
family list sync state |
chat_launch_checkin, chat_checkin_last_date, chat_checkin_lock, chat_names, chat_notify_prefs, chat_notify_held:<email>, push_vapid |
chat, check-ins, notifications |
Left out of the full backup: auth_secret, password_hash, API keys, preview_tokens, mcp_tokens, push_vapid, code-guess rows (and held notifications).