Skip to content

data: user_places migration is weaker than the app contract (no type CHECK, UPDATE policy missing WITH CHECK, no lat/lng ranges) #170

Description

@shauryagangrade

Problem

supabase/migrations/20260701_create_user_places.sql vs what the app assumes:

  1. type text has no CHECK against the six valid PLACE_TYPES → a bad value makes PLACE_TYPE_LABELS[place.type] / PLACE_TYPE_COLORS[place.type] return undefined at render time (my-places-panel.tsx:153, map-view.tsx:177)
  2. The UPDATE policy lacks WITH CHECK (auth.uid() = user_id) — Postgres RLS best practice; without it a row could be moved to another user_id by update
  3. lat/lng have no range constraints (mirrors the client-side validation gap)
  4. Header comments still contain AI-session artifacts ("Requires dashboard/CLI access this repo's Claude session did not have...") — worth scrubbing before more forks copy this file

Same review should cover user_home and user_events.

Acceptance criteria

  • DB rejects invalid types/out-of-range coords
  • UPDATE policies are WITH CHECK-complete

Metadata

Metadata

Assignees

No one assigned

    Labels

    dataPlaces datasetmaintainerNeeds repo admin access, not open for contributionself-hostSelf-host / bring-your-own-data

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions