🎉 Initial Commit
This commit is contained in:
19
supabase/migrations/20231210071647_profiles.sql
Normal file
19
supabase/migrations/20231210071647_profiles.sql
Normal file
@ -0,0 +1,19 @@
|
||||
create table public.profiles (
|
||||
id uuid not null references auth.users on delete cascade,
|
||||
username varchar(64),
|
||||
nickname varchar(256),
|
||||
school_id int8,
|
||||
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
alter table public.profiles enable row level security;
|
||||
|
||||
create policy "Public profiles are viewable by everyone." on profiles
|
||||
for select using (true);
|
||||
|
||||
create policy "Users can insert their own profile." on profiles
|
||||
for insert with check (auth.uid() = id);
|
||||
|
||||
create policy "Users can update own profile." on profiles
|
||||
for update using (auth.uid() = id);
|
19
supabase/migrations/20231210071842_problems.sql
Normal file
19
supabase/migrations/20231210071842_problems.sql
Normal file
@ -0,0 +1,19 @@
|
||||
create table
|
||||
public.problems (
|
||||
id bigint generated by default as identity,
|
||||
title text not null,
|
||||
description text not null,
|
||||
type character varying not null,
|
||||
tags character varying[] null,
|
||||
author uuid null,
|
||||
is_draft boolean null default true,
|
||||
is_hidden boolean null default false,
|
||||
created_at timestamp with time zone null default now(),
|
||||
constraint problems_pkey primary key (id),
|
||||
constraint problems_author_fkey foreign key (author) references auth.users (id)
|
||||
) tablespace pg_default;
|
||||
|
||||
alter table public.problems enable row level security;
|
||||
|
||||
create policy "Public problems are viewable by everyone." on problems
|
||||
for select using (true);
|
Reference in New Issue
Block a user