> ## Documentation Index
> Fetch the complete documentation index at: https://ratemyrentalco.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Data model

> Housing v1 tables for profiles, properties, and reviews, plus the RLS posture.

v1 is housing-only. Keep the schema property-centric. Introduce a generic listing model only when non-housing categories ship.

## Entities

```mermaid theme={null}
erDiagram
  profiles ||--o{ properties : owns
  profiles ||--o{ reviews : writes
  properties ||--o{ reviews : receives
  profiles {
    uuid id PK
    boolean is_renter
    boolean is_owner
    text last_dashboard
  }
  properties {
    uuid id PK
    uuid owner_id FK
    text name
    text address
    text city
    text state
  }
  reviews {
    uuid id PK
    uuid property_id FK
    uuid renter_id FK
    int rating
    text title
    text content
  }
```

### profiles

* `id` matches `auth.users.id`
* `is_renter` / `is_owner` drive dashboard access
* `last_dashboard` is `renter`, `owner`, or null
* Display fields (name, avatar) may be added as product needs them

### properties

* Owned by a profile with `is_owner` true at write time
* Publicly readable for browse and detail pages

### reviews

* Written by a profile with `is_renter` true at write time
* `rating` is an integer from 1 to 5
* Publicly readable on property detail pages

## RLS summary

| Table | SELECT | INSERT / UPDATE / DELETE |
| - | - | - |
| `profiles` | Own row only (authenticated) | Own row only; role flags via controlled onboarding/settings paths |
| `properties` | Public read | Owner of the row only |
| `reviews` | Public read | Renter who owns the review only |

Do not grant broad anon writes. Authenticated server code uses the user session so RLS applies. Prefer the service role only for trusted admin or system jobs, never in the browser.

## Migrations

SQL migrations live in `ratemyrental-web` under `supabase/migrations`. Apply them with the Supabase CLI or the project SQL editor. See the web repo README for the current project ref.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.