Créez la base de données
Dans votre projet Supabase → SQL Editor → "New query" → copiez-collez ce code et cliquez "Run" :
-- Table principale
create table planning_data (
id int primary key default 1,
events jsonb default '[]',
clients jsonb default '[]',
lieux jsonb default '[]',
personnel jsonb default '[]',
settings jsonb default '{}',
updated_at timestamptz default now()
);
insert into planning_data (id) values (1)
on conflict (id) do nothing;
alter table planning_data enable row level security;
create policy "Accès public" on planning_data
for all using (true) with check (true);
-- Table des rôles utilisateurs (gestion des accès in-app)
create table planning_roles (
email text primary key,
role text not null default 'viewer'
);
alter table planning_roles enable row level security;
create policy "Allow all authenticated" on planning_roles
for all to authenticated using (true) with check (true);
create policy "Allow anon read" on planning_roles
for select to anon using (true);
-- Si vous avez déjà planning_data, lancez juste ceci :
-- alter table planning_data add column if not exists personnel jsonb default '[]';
-- alter table planning_data add column if not exists settings jsonb default '{}';