create extension if not exists pgcrypto;
create table if not exists orders (
  id uuid primary key default gen_random_uuid(),
  created_at timestamptz default now(),
  product text not null default 'bruidspaar-taarttopper',
  email text not null,
  name text not null,
  style text not null,
  wedding_date text,
  notes text,
  status text default 'new',
  payment_status text default 'pending',
  preview_url text,
  adyen_session_id text
);
create table if not exists uploads (
  id uuid primary key default gen_random_uuid(),
  created_at timestamptz default now(),
  order_id uuid references orders(id) on delete cascade,
  image_url text not null,
  path text
);
-- Maak in Supabase Storage een public bucket: order-uploads
-- Voor live gebruik: maak uploads privé en gebruik signed URLs.
