Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
71 lines
2.5 KiB
PL/PgSQL
71 lines
2.5 KiB
PL/PgSQL
-- Menivor on its own Scribase project: social-auth profiles.
|
|
-- Ported from apps/mobile/supabase/migrations/0001_profiles.sql (schema
|
|
-- menivor -> public; the per-app schema existed only to share the old cipher
|
|
-- project). One row per auth user, created on sign-up; RLS keeps each user to
|
|
-- their own row. The mobile app itself only uses Auth (Apple sign-in); the
|
|
-- Menivor account lives in the Menivor API, which verifies these tokens.
|
|
|
|
create table if not exists public.profiles (
|
|
id uuid primary key references auth.users (id) on delete cascade,
|
|
email text,
|
|
full_name text,
|
|
avatar_url text,
|
|
created_at timestamptz not null default now(),
|
|
updated_at timestamptz not null default now()
|
|
);
|
|
|
|
alter table public.profiles enable row level security;
|
|
revoke all on public.profiles from anon;
|
|
grant select, insert, update on public.profiles to authenticated;
|
|
|
|
drop policy if exists "profiles_select_own" on public.profiles;
|
|
create policy "profiles_select_own" on public.profiles for select
|
|
to authenticated using (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 (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 (auth.uid() = id) with check (auth.uid() = id);
|
|
|
|
create or replace function public.set_profiles_updated_at()
|
|
returns trigger
|
|
language plpgsql
|
|
set search_path = public
|
|
as $$
|
|
begin
|
|
new.updated_at = now();
|
|
return new;
|
|
end;
|
|
$$;
|
|
|
|
drop trigger if exists profiles_set_updated_at on public.profiles;
|
|
create trigger profiles_set_updated_at
|
|
before update on public.profiles
|
|
for each row execute function public.set_profiles_updated_at();
|
|
|
|
create or replace function public.handle_new_user()
|
|
returns trigger
|
|
language plpgsql
|
|
security definer
|
|
set search_path = public
|
|
as $$
|
|
begin
|
|
insert into public.profiles (id, email, full_name, avatar_url)
|
|
values (
|
|
new.id,
|
|
new.email,
|
|
coalesce(new.raw_user_meta_data ->> 'full_name', new.raw_user_meta_data ->> 'name'),
|
|
new.raw_user_meta_data ->> 'avatar_url'
|
|
)
|
|
on conflict (id) do nothing;
|
|
return new;
|
|
end;
|
|
$$;
|
|
revoke all on function public.handle_new_user() from public, anon, authenticated;
|
|
|
|
drop trigger if exists on_auth_user_created on auth.users;
|
|
create trigger on_auth_user_created
|
|
after insert on auth.users
|
|
for each row execute function public.handle_new_user();
|