Go to supabase.com, create a free project, open SQL Editor → New query, paste and run:
CREATE TABLE IF NOT EXISTS public.bookings (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
customer_name text NOT NULL,
phone text,
date date NOT NULL,
time_slot text NOT NULL,
duration integer NOT NULL DEFAULT 1,
court text NOT NULL,
fee integer NOT NULL DEFAULT 0,
payment_method text DEFAULT 'Cash',
discount_note text DEFAULT '',
group_id text DEFAULT '',
created_at timestamptz DEFAULT now()
);
ALTER TABLE public.bookings ENABLE ROW LEVEL SECURITY;
DROP POLICY IF EXISTS "allow_all" ON public.bookings;
CREATE POLICY "allow_all" ON public.bookings
FOR ALL USING (true) WITH CHECK (true);
If you already have the table, run these to add the new columns:
ALTER TABLE public.bookings ADD COLUMN IF NOT EXISTS duration integer NOT NULL DEFAULT 1;
ALTER TABLE public.bookings ADD COLUMN IF NOT EXISTS payment_method text DEFAULT 'Cash';
ALTER TABLE public.bookings ADD COLUMN IF NOT EXISTS discount_note text DEFAULT '';
ALTER TABLE public.bookings ADD COLUMN IF NOT EXISTS group_id text DEFAULT '';
ALTER TABLE public.bookings ADD COLUMN IF NOT EXISTS created_by text DEFAULT '';
Then run this to create the auth support tables:
CREATE TABLE IF NOT EXISTS public.profiles (
id uuid REFERENCES auth.users(id) ON DELETE CASCADE PRIMARY KEY,
email text,
full_name text,
role text DEFAULT 'staff',
created_at timestamptz DEFAULT now()
);
ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY;
CREATE POLICY "profiles_all" ON public.profiles FOR ALL USING (true) WITH CHECK (true);
CREATE TABLE IF NOT EXISTS public.app_settings (
key text PRIMARY KEY,
value text NOT NULL,
updated_at timestamptz DEFAULT now()
);
ALTER TABLE public.app_settings ENABLE ROW LEVEL SECURITY;
CREATE POLICY "settings_all" ON public.app_settings FOR ALL USING (true) WITH CHECK (true);
-- Seed default pricing (edit anytime in the Settings tab)
INSERT INTO public.app_settings (key,value) VALUES
('price_day','550'),
('price_eve','700'),
('pay_gcash_num','0917 321 ****'),
('pay_gcash_name','Pickle at The Kiln'),
('pay_gotyme_num','****2253'),
('pay_gotyme_name','Pickle at The Kiln')
ON CONFLICT (key) DO NOTHING;
CREATE TABLE IF NOT EXISTS public.booking_requests (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
customer_name text NOT NULL,
phone text,
date date NOT NULL,
start_hour integer NOT NULL,
end_hour integer NOT NULL,
courts text[] NOT NULL,
status text DEFAULT 'pending',
hold_expires_at timestamptz,
payment_method text DEFAULT '',
receipt_url text DEFAULT '',
receipt_note text DEFAULT '',
fee integer NOT NULL DEFAULT 0,
created_at timestamptz DEFAULT now()
);
ALTER TABLE public.booking_requests ENABLE ROW LEVEL SECURITY;
CREATE POLICY "requests_all" ON public.booking_requests FOR ALL USING (true) WITH CHECK (true);
-- Storage bucket for receipts (run in Supabase Storage settings)
-- Create a public bucket named: receipts
If you already have booking_requests, add the new columns:
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS hold_expires_at timestamptz;
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS payment_method text DEFAULT '';
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS receipt_url text DEFAULT '';
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS receipt_note text DEFAULT '';
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS fee integer NOT NULL DEFAULT 0;
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS booking_ref text DEFAULT '';
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS receipt_hash text DEFAULT '';
ALTER TABLE public.booking_requests ADD COLUMN IF NOT EXISTS recurring_group text DEFAULT '';
Then go to Project Settings → API and paste below.
| Customer | Time | Court | Payment | Fee | Status |
|---|
| Customer | Phone | Date | Start | End | Court | Hrs | Payment | Fee | Paid | Note |
|---|
| Name | Phone | Visits | Total hrs | Total spent | Last visit |
|---|
Pick a month — customers see availability only, no names.
Mark a court as unavailable for maintenance, cleaning, or a private reservation. It will show as blocked on the customer calendar.
| Court | Date | Time | Reason |
|---|
TheKiln. — Cebu | Availability updates in real time