Spaces:
Runtime error
Runtime error
Sidd-mukho77
Claude Sonnet 4.5
feat: Add Supabase integration for voucher logging and storage
f9b1caa Download create_fresh_table.sql from fgf-technical-trial/voucher-new: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/spaces/fgf-technical-trial/voucher-new/resolve/main/create_fresh_table.sql
- Command line
-
hf download hf://spaces/fgf-technical-trial/voucher-new/create_fresh_table.sql
-
curl -L -o create_fresh_table.sql https://huggingface.co/spaces/fgf-technical-trial/voucher-new/resolve/main/create_fresh_table.sql
1.95 kB
| -- Create Fresh Generations Table for Voucher Generator | |
| -- Run this in Supabase SQL Editor for a clean installation | |
| -- Drop existing table if you want to start fresh (CAUTION: This deletes all data!) | |
| -- DROP TABLE IF EXISTS public.generations; | |
| -- Create the generations table with all required columns | |
| CREATE TABLE IF NOT EXISTS public.generations ( | |
| -- Auto-generated fields | |
| id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, | |
| created_at timestamptz NOT NULL DEFAULT now(), | |
| -- Hotel information | |
| hotel_name text NOT NULL, | |
| city text, | |
| address_line1 text, | |
| address_line2 text, | |
| phone text, | |
| -- Guest information | |
| primary_guest_name text NOT NULL, | |
| num_guests integer NOT NULL DEFAULT 1, | |
| num_rooms integer NOT NULL DEFAULT 1, | |
| guest_details jsonb, | |
| -- Booking dates | |
| checkin_date date NOT NULL, | |
| checkout_date date NOT NULL, | |
| num_nights integer NOT NULL DEFAULT 1, | |
| -- Room details | |
| room_type text, | |
| room_size text, | |
| meal_plan text DEFAULT 'Breakfast Only', | |
| -- Policy details | |
| policy text DEFAULT 'Non-Refundable', | |
| is_refundable boolean DEFAULT false, | |
| cancellation_days integer, | |
| remarks text, | |
| -- PDF tracking | |
| pdf_filename text NOT NULL, | |
| pdf_url text, | |
| pdf_storage_path text, | |
| -- Metadata | |
| tab_source text NOT NULL DEFAULT 'Search Hotel', | |
| is_bulk boolean DEFAULT false | |
| ); | |
| -- Create index on created_at for faster date range queries | |
| CREATE INDEX IF NOT EXISTS idx_generations_created_at ON public.generations(created_at DESC); | |
| -- Create index on hotel_name for faster searches | |
| CREATE INDEX IF NOT EXISTS idx_generations_hotel_name ON public.generations(hotel_name); | |
| -- Create index on checkin_date for date-based queries | |
| CREATE INDEX IF NOT EXISTS idx_generations_checkin_date ON public.generations(checkin_date); | |
| -- Verify table was created successfully | |
| SELECT | |
| 'Table created successfully!' as status, | |
| count(*) as column_count | |
| FROM information_schema.columns | |
| WHERE table_name = 'generations'; | |