This document aims to provide a comprehensive database description, covering all design decisions. It is important to understand concepts in a SQL (Structured Query Language) database.
Tables
Row Level Security
Default Policy Template
create policy "policy_name" on table_name
for all
using (auth.uid() = user_id and not deleted);Row Level Security
- Enforces rules to restrict actions on a table, for example, restricting a group of users from viewing data.
- Are permissive by default, meaning NO action is allowed by users, only admin. Creating a policy lifts the restrictions.
- Apply to each row in a table, to understand this imagine 2 unique users have information in the same table, but an RLS policy is setup so each user can only see their own information.
| Description | Select | Update | Insert | Delete |
|---|---|---|---|---|
| Users can read their own device details | ✅ | ❌ | ❌ | ❌ |