-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
27 lines (23 loc) · 801 Bytes
/
Copy pathschema.sql
File metadata and controls
27 lines (23 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Supabase / PostgreSQL schema for personal-Review app
-- Run this in the Supabase SQL editor or psql
-- Enable pgcrypto for gen_random_uuid()
create extension if not exists pgcrypto;
create table if not exists users (
id uuid primary key default gen_random_uuid(),
name text,
username text unique,
email text unique,
age integer,
gender text,
created_at timestamptz default now()
);
create table if not exists reviews (
id uuid primary key default gen_random_uuid(),
user_id uuid references users(id) on delete set null,
username text,
app_name text not null,
rating integer check (rating >= 0 and rating <= 5),
description text,
created_at timestamptz default now()
);
create index if not exists idx_reviews_app_name on reviews(app_name);