Files
Bookra/apps/backend/migrations/00019_intake_fields.sql
T
Tomas DvorakandDevin 33b6e2a2a6 feat(intake): structured per-service intake questions
Services declare up to 8 intake fields (text/yesno, required) stored
as JSONB; shared/intake.go is the single normalization point — slug
keys, label/dup/unknown-key rules, yes/no canonicalization. Booking
create validates answers against the service declaration (missing
required -> 400), unknown keys are dropped before persist.

Answers surface on UpcomingBooking and CustomerBookingView; the
services page gains a compact editor and the public form renders
declared questions under contact details. Verified live end-to-end.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 18:04:32 +02:00

14 lines
576 B
SQL

-- +goose Up
-- Schema-light structured intake: services declare a small list of intake
-- fields (key/label/type/required); bookings store the customer's answers as
-- a JSON object keyed by the declared field keys. Both default to empty so
-- existing services/bookings need no backfill.
ALTER TABLE services
ADD COLUMN intake_fields jsonb NOT NULL DEFAULT '[]'::jsonb;
ALTER TABLE bookings
ADD COLUMN intake jsonb NOT NULL DEFAULT '{}'::jsonb;
-- +goose Down
ALTER TABLE services DROP COLUMN IF EXISTS intake_fields;
ALTER TABLE bookings DROP COLUMN IF EXISTS intake;