mono/packages/ui/docs/products.md
2026-04-01 17:24:08 +02:00

2.6 KiB

create table public.products ( id bigint generated by default as identity not null, name text not null, slug text not null, description text null, price numeric(10, 2) not null default 0, variants jsonb null default '[]'::jsonb, created_at timestamp with time zone not null default timezone ('utc'::text, now()), updated_at timestamp with time zone not null default timezone ('utc'::text, now()), constraint products_pkey primary key (id), constraint products_slug_key unique (slug) ) TABLESPACE pg_default;

create table public.product_variants ( id bigint generated by default as identity not null, product_id bigint not null, name text not null, price numeric(10, 2) not null default 0, created_at timestamp with time zone not null default timezone ('utc'::text, now()), updated_at timestamp with time zone not null default timezone ('utc'::text, now()), constraint product_variants_pkey primary key (id), constraint product_variants_product_id_fkey foreign key (product_id) references products(id) on delete cascade ) TABLESPACE pg_default;

===================================

//current map create table public.resource_acl ( id uuid not null default gen_random_uuid (), resource_type text not null, resource_id text not null, resource_owner_id uuid null, user_id uuid null, group_name text null, permissions text[] not null default '{}'::text[], path text null default '/'::text, meta jsonb null default '{}'::jsonb, log jsonb null default '{}'::jsonb, created_at timestamp with time zone null default now(), updated_at timestamp with time zone null default now(), constraint resource_acl_pkey primary key (id), constraint resource_acl_resource_owner_id_fkey foreign KEY (resource_owner_id) references auth.users (id), constraint resource_acl_user_id_fkey foreign KEY (user_id) references auth.users (id) on delete CASCADE, constraint check_grantee check ( ( ( (user_id is not null) and (group_name is null) ) or ( (user_id is null) and (group_name is not null) ) or ( (user_id is null) and (group_name is null) ) ) ) ) TABLESPACE pg_default;

create index IF not exists idx_resource_acl_lookup on public.resource_acl using btree (resource_type, resource_id) TABLESPACE pg_default;

create index IF not exists idx_resource_acl_user on public.resource_acl using btree (user_id) TABLESPACE pg_default;

create index IF not exists idx_resource_acl_owner on public.resource_acl using btree (resource_owner_id) TABLESPACE pg_default;