سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 23:15 UTC
test(auth): mirror existing phone columns in disposable identity fixture
davoodmehraban89 committed
Oct 12, 2026 at 11:15 UTC
6e2e950e0cace4a54f2654438d3c4370df16c6ae
1 file changed
+2
-2
supabase/tests/identity_wave5a_bootstrap.sql
+2
-2
@@ -4,8 +4,8 @@ do $$ begin
4
if not exists(select 1 from pg_roles where rolname='authenticated') then create role authenticated nologin; end if;
5
end $$;
6
create schema if not exists auth;
7
-create table auth.users(id uuid primary key,email text,raw_user_meta_data jsonb not null default '{}'::jsonb);
8
-create table public.profiles(id uuid primary key references auth.users(id) on delete cascade,username text,role text not null default 'user',created_at timestamptz not null default now(),email text not null,full_name text);
7
+create table auth.users(id uuid primary key,email text,phone text,raw_user_meta_data jsonb not null default '{}'::jsonb);
8
+create table public.profiles(id uuid primary key references auth.users(id) on delete cascade,username text,role text not null default 'user',created_at timestamptz not null default now(),email text,phone text,full_name text);
9
create table public.organizations(id uuid primary key default gen_random_uuid(),owner_user_id uuid not null references public.profiles(id) on delete restrict,name text not null check(char_length(trim(name)) between 1 and 160),status text not null default 'active' check(status in('active','suspended')),created_at timestamptz not null default now(),updated_at timestamptz not null default now());
10
create table public.organization_members(id uuid primary key default gen_random_uuid(),organization_id uuid not null references public.organizations(id) on delete cascade,user_id uuid not null references public.profiles(id) on delete cascade,unit_id uuid,position_title text,status text not null default 'active' check(status in('active','suspended','left')),is_owner boolean not null default false,created_at timestamptz not null default now(),updated_at timestamptz not null default now(),unique(organization_id,user_id));
11
create table public.licenses(user_id uuid primary key references public.profiles(id) on delete cascade,plan text not null check(plan in('trial','monthly','three_months','annual','lifetime')),status text not null check(status in('trial','active','cancelled')),starts_at date not null default current_date,ends_at date not null,updated_at timestamptz not null default now(),max_companies integer not null default 1 check(max_companies between 1 and 1000),modules text[] not null default array['full_suite']::text[],organization_id uuid not null references public.organizations(id) on delete restrict,max_users integer not null default 1 check(max_users between 1 and 100000),limits jsonb not null default '{}'::jsonb check(jsonb_typeof(limits)='object'));