feat: initial commit
This commit is contained in:
commit
7d443a004a
76 changed files with 15704 additions and 0 deletions
1
supabase/.temp/cli-latest
Normal file
1
supabase/.temp/cli-latest
Normal file
|
|
@ -0,0 +1 @@
|
|||
v2.90.0
|
||||
1
supabase/.temp/gotrue-version
Normal file
1
supabase/.temp/gotrue-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
v2.188.1
|
||||
1
supabase/.temp/linked-project.json
Normal file
1
supabase/.temp/linked-project.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"ref":"yntzfgnkrwjlnbaxxkkc","name":"madhura68's Project","organization_id":"muclgkbblfugxcxrrjaj","organization_slug":"muclgkbblfugxcxrrjaj"}
|
||||
1
supabase/.temp/pooler-url
Normal file
1
supabase/.temp/pooler-url
Normal file
|
|
@ -0,0 +1 @@
|
|||
postgresql://postgres.yntzfgnkrwjlnbaxxkkc@aws-0-eu-west-1.pooler.supabase.com:5432/postgres
|
||||
1
supabase/.temp/postgres-version
Normal file
1
supabase/.temp/postgres-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
17.6.1.104
|
||||
1
supabase/.temp/project-ref
Normal file
1
supabase/.temp/project-ref
Normal file
|
|
@ -0,0 +1 @@
|
|||
yntzfgnkrwjlnbaxxkkc
|
||||
1
supabase/.temp/rest-version
Normal file
1
supabase/.temp/rest-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
v14.5
|
||||
1
supabase/.temp/storage-migration
Normal file
1
supabase/.temp/storage-migration
Normal file
|
|
@ -0,0 +1 @@
|
|||
operation-ergonomics
|
||||
1
supabase/.temp/storage-version
Normal file
1
supabase/.temp/storage-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
v1.48.20
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
alter table public.profiles
|
||||
add column if not exists onboarding_seen boolean not null default false;
|
||||
|
||||
update public.profiles
|
||||
set onboarding_seen = true
|
||||
where onboarding_completed = true
|
||||
and onboarding_seen = false;
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
create or replace function public.set_updated_at()
|
||||
returns trigger
|
||||
language plpgsql
|
||||
as $$
|
||||
begin
|
||||
new.updated_at = timezone('utc', now());
|
||||
return new;
|
||||
end;
|
||||
$$;
|
||||
|
||||
create table if not exists public.profiles (
|
||||
id uuid primary key references auth.users (id) on delete cascade,
|
||||
email text,
|
||||
display_name text,
|
||||
locale text not null default 'nl-NL',
|
||||
timezone text not null default 'Europe/Amsterdam',
|
||||
onboarding_completed boolean not null default false,
|
||||
created_at timestamptz not null default timezone('utc', now()),
|
||||
updated_at timestamptz not null default timezone('utc', now())
|
||||
);
|
||||
|
||||
create table if not exists public.user_settings (
|
||||
profile_id uuid primary key references public.profiles (id) on delete cascade,
|
||||
morning_reminder_enabled boolean not null default false,
|
||||
morning_reminder_time time,
|
||||
reflection_reminder_enabled boolean not null default false,
|
||||
show_energy_points boolean not null default true,
|
||||
created_at timestamptz not null default timezone('utc', now()),
|
||||
updated_at timestamptz not null default timezone('utc', now())
|
||||
);
|
||||
|
||||
grant usage on schema public to authenticated;
|
||||
grant select, insert, update on table public.profiles to authenticated;
|
||||
grant select, insert, update on table public.user_settings to authenticated;
|
||||
|
||||
alter table public.profiles enable row level security;
|
||||
alter table public.user_settings enable row level security;
|
||||
|
||||
drop trigger if exists set_profiles_updated_at on public.profiles;
|
||||
create trigger set_profiles_updated_at
|
||||
before update on public.profiles
|
||||
for each row
|
||||
execute function public.set_updated_at();
|
||||
|
||||
drop trigger if exists set_user_settings_updated_at on public.user_settings;
|
||||
create trigger set_user_settings_updated_at
|
||||
before update on public.user_settings
|
||||
for each row
|
||||
execute function public.set_updated_at();
|
||||
|
||||
drop policy if exists "profiles_select_own" on public.profiles;
|
||||
create policy "profiles_select_own"
|
||||
on public.profiles
|
||||
for select
|
||||
to authenticated
|
||||
using ((select auth.uid()) = id);
|
||||
|
||||
drop policy if exists "profiles_insert_own" on public.profiles;
|
||||
create policy "profiles_insert_own"
|
||||
on public.profiles
|
||||
for insert
|
||||
to authenticated
|
||||
with check ((select auth.uid()) = id);
|
||||
|
||||
drop policy if exists "profiles_update_own" on public.profiles;
|
||||
create policy "profiles_update_own"
|
||||
on public.profiles
|
||||
for update
|
||||
to authenticated
|
||||
using ((select auth.uid()) = id)
|
||||
with check ((select auth.uid()) = id);
|
||||
|
||||
drop policy if exists "user_settings_select_own" on public.user_settings;
|
||||
create policy "user_settings_select_own"
|
||||
on public.user_settings
|
||||
for select
|
||||
to authenticated
|
||||
using ((select auth.uid()) = profile_id);
|
||||
|
||||
drop policy if exists "user_settings_insert_own" on public.user_settings;
|
||||
create policy "user_settings_insert_own"
|
||||
on public.user_settings
|
||||
for insert
|
||||
to authenticated
|
||||
with check ((select auth.uid()) = profile_id);
|
||||
|
||||
drop policy if exists "user_settings_update_own" on public.user_settings;
|
||||
create policy "user_settings_update_own"
|
||||
on public.user_settings
|
||||
for update
|
||||
to authenticated
|
||||
using ((select auth.uid()) = profile_id)
|
||||
with check ((select auth.uid()) = profile_id);
|
||||
Loading…
Add table
Add a link
Reference in a new issue