-- Numero de mesas del negocio (persistido) + realtime para cuentas de mesa.
alter table public.restaurantes add column if not exists num_mesas int not null default 0;

do $$
begin
  if not exists (
    select 1 from pg_publication_tables
    where pubname = 'supabase_realtime' and schemaname = 'public' and tablename = 'cuentas_mesa'
  ) then
    alter publication supabase_realtime add table public.cuentas_mesa;
  end if;
end $$;
