Download docs/reference/supabase_schema.sql from Alfayadh/vela-app: direct link, hf CLI and curl.
- Browser
- Download file 2.48 kB
-
https://huggingface.co/spaces/Alfayadh/vela-app/resolve/main/docs/reference/supabase_schema.sql
- Command line
-
hf download hf://spaces/Alfayadh/vela-app/docs/reference/supabase_schema.sql
-
curl -L -o supabase_schema.sql https://huggingface.co/spaces/Alfayadh/vela-app/resolve/main/docs/reference/supabase_schema.sql
2.48 kB
| -- ============================================================================ | |
| -- Vela Academy — Schema Supabase (jalankan di SQL Editor Supabase) | |
| -- | |
| -- Data akademik TIDAK disimpan lokal agar aman saat redeploy HF Spaces. | |
| -- Set env: SUPABASE_URL & SUPABASE_KEY (service_role, server-side only). | |
| -- ============================================================================ | |
| create table if not exists public.courses ( | |
| id uuid primary key default gen_random_uuid(), | |
| kode text default '', | |
| nama text not null, | |
| sks int default 0, | |
| dosen text default '', | |
| ruangan text default '', | |
| warna text default '#7C3AED', | |
| keywords text default '', | |
| created_at timestamptz not null default now() | |
| ); | |
| create table if not exists public.notes ( | |
| id uuid primary key default gen_random_uuid(), | |
| course_id uuid references public.courses(id) on delete set null, | |
| session_date date, | |
| title text default '', | |
| content_md text default '', | |
| updated_at timestamptz not null default now() | |
| ); | |
| create table if not exists public.attendance ( | |
| id uuid primary key default gen_random_uuid(), | |
| course_id uuid references public.courses(id) on delete cascade, | |
| session_date date not null, | |
| status text not null check (status in ('hadir','alpa','izin')), | |
| note text default '', | |
| created_at timestamptz not null default now(), | |
| unique (course_id, session_date) | |
| ); | |
| create table if not exists public.grade_components ( | |
| id uuid primary key default gen_random_uuid(), | |
| course_id uuid references public.courses(id) on delete cascade, | |
| name text not null, | |
| weight numeric not null check (weight > 0), | |
| score numeric check (score is null or (score >= 0 and score <= 100)) | |
| ); | |
| create table if not exists public.notification_log ( | |
| dedup_key text primary key, | |
| channel text not null, | |
| sent_at timestamptz not null default now() | |
| ); | |
| -- Index ringan untuk pencarian catatan | |
| create index if not exists notes_course_idx on public.notes(course_id); | |
| create index if not exists attendance_course_idx on public.attendance(course_id); | |
| create index if not exists grade_course_idx on public.grade_components(course_id); | |
| -- RLS: akses hanya dari server via service_role key (frontend tidak memegang kunci). | |
| alter table public.courses enable row level security; | |
| alter table public.notes enable row level security; | |
| alter table public.attendance enable row level security; | |
| alter table public.grade_components enable row level security; | |
| alter table public.notification_log enable row level security; | |