← back to NationalPaperHangers

db/migrations/022_room_captures.sql

35 lines

-- 022 · Room capture & measure — camera-driven booking brief
--
-- The customer photographs/videos each room, marks the wall, confirms its
-- height & width, and optionally uploads the wallpaper they intend to use
-- (with its exact panel width + pattern repeat) so it can be previewed on the
-- measured wall. The whole package travels with the booking so the installer
-- quotes from real footage + dimensions instead of a typed guess.
--
-- One JSONB array rather than a child table: captures are write-once with the
-- booking, always read as a unit, and never queried field-wise.

BEGIN;

ALTER TABLE bookings
  ADD COLUMN IF NOT EXISTS room_captures JSONB NOT NULL DEFAULT '[]'::jsonb;

-- Shape of each element (all distances in feet unless noted):
--   {
--     "room":            "Dining room",
--     "wall_width_ft":    12.5,
--     "wall_height_ft":   9,
--     "photo_url":        "/uploads/bookings/<batch>/<hash>.jpg",
--     "video_url":        "/uploads/bookings/<batch>/<hash>.mp4" | null,
--     "wallpaper": {                       -- null when the customer skips it
--       "image_url":  "/uploads/bookings/<batch>/<hash>.jpg",
--       "width_in":   27,                  -- exact panel/roll width, inches
--       "repeat_in":  18,                  -- vertical pattern repeat, inches
--       "match_type": "straight" | "half_drop"
--     }
--   }
COMMENT ON COLUMN bookings.room_captures IS
  'Camera-captured rooms: per-wall photo/video, confirmed dimensions, and optional customer-supplied wallpaper (width + repeat) for on-wall preview.';

COMMIT;