/
dmukhin
/
SpherePlatform
Обзор
Документация
Войти
/
dmukhin
/
SpherePlatform
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
db/init/02_sphere_schema.sql
49 строк
2 KB
OIS\sabogdan
first commit
24 мар 2026, 07:50
24 мар 2026, 07:50
b0e18c7
Код
Авторство
О чём код?
-- Core tables for Sphere (Applications / dashboards). Idempotent where possible. -- Apply after Supabase Postgres is up. For upgrading an existing database with a -- different layout, use your migration scripts (e.g. project SQL notes) instead. create table if not exists public.application_groups ( id uuid primary key default gen_random_uuid(), name text not null, parent_id uuid references public.application_groups (id) on delete set null, sort_order text ); create table if not exists public.applications ( id uuid primary key default gen_random_uuid(), name text not null, application_group_id uuid references public.application_groups (id) on delete set null, type text, content text, description text ); create index if not exists idx_applications_application_group_id on public.applications (application_group_id); alter table public.application_groups enable row level security; alter table public.applications enable row level security; drop policy if exists "sphere_application_groups_all" on public.application_groups; create policy "sphere_application_groups_all" on public.application_groups for all to anon, authenticated, service_role using (true) with check (true); drop policy if exists "sphere_applications_all" on public.applications; create policy "sphere_applications_all" on public.applications for all to anon, authenticated, service_role using (true) with check (true); grant usage on schema public to anon, authenticated; grant select, insert, update, delete on table public.application_groups to anon, authenticated; grant select, insert, update, delete on table public.applications to anon, authenticated; grant all on table public.application_groups to service_role; grant all on table public.applications to service_role;