Spaces:
Sleeping
Sleeping
File size: 1,604 Bytes
683e917 9caa6a9 683e917 | 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | -- create_tables.sql
-- Run this in Supabase SQL editor to create tables used by the app.
create table if not exists users (
id text primary key,
phone text unique,
name text,
preferred_language text default 'en',
role text default 'user',
created_at timestamptz default now()
);
create table if not exists maids (
id text primary key,
user_id text references users(id),
kyc_status text default 'pending',
skills text[],
languages text[] default array['en'],
service_radius_km int default 10,
rating_avg double precision default 0.0,
rating_count int default 0,
created_at timestamptz default now()
);
create table if not exists maid_locations (
id uuid primary key default gen_random_uuid(),
maid_id text references maids(id),
lon double precision,
lat double precision,
updated_at timestamptz default now()
);
create table if not exists services (
id text primary key,
name text,
slug text unique,
description text,
base_price int,
min_duration_min int default 30,
add_ons jsonb
);
create table if not exists bookings (
id text primary key,
user_id text references users(id),
maid_id text references maids(id),
service_id text references services(id),
status text default 'pending',
scheduled_at timestamptz,
start_eta_min int,
price_total int,
address jsonb,
notes text,
created_at timestamptz default now()
);
create table if not exists booking_events (
id uuid primary key default gen_random_uuid(),
booking_id text references bookings(id),
type text,
payload jsonb,
created_at timestamptz default now()
);
|