Merge branch 'main' into B2B-30

This commit is contained in:
devmc-ee
2025-06-22 15:26:55 +03:00
16 changed files with 1852 additions and 1938 deletions

View File

@@ -48,6 +48,48 @@ export type Database = {
}
Relationships: []
}
request_entries: {
Row: {
comment: string | null
created_at: string
id: number
personal_code: number | null
request_api: string
request_api_method: string
requested_end_date: string | null
requested_start_date: string | null
service_id: number | null
service_provider_id: number | null
status: Database["audit"]["Enums"]["request_status"]
}
Insert: {
comment?: string | null
created_at?: string
id?: number
personal_code?: number | null
request_api: string
request_api_method: string
requested_end_date?: string | null
requested_start_date?: string | null
service_id?: number | null
service_provider_id?: number | null
status: Database["audit"]["Enums"]["request_status"]
}
Update: {
comment?: string | null
created_at?: string
id?: number
personal_code?: number | null
request_api?: string
request_api_method?: string
requested_end_date?: string | null
requested_start_date?: string | null
service_id?: number | null
service_provider_id?: number | null
status?: Database["audit"]["Enums"]["request_status"]
}
Relationships: []
}
sync_entries: {
Row: {
changed_by_role: string
@@ -83,6 +125,7 @@ export type Database = {
[_ in never]: never
}
Enums: {
request_status: "SUCCESS" | "FAIL"
sync_status: "SUCCESS" | "FAIL"
}
CompositeTypes: {
@@ -596,6 +639,158 @@ export type Database = {
}
Relationships: []
}
connected_online_providers: {
Row: {
can_select_worker: boolean
created_at: string
email: string | null
id: number
name: string
personal_code_required: boolean
phone_number: string | null
updated_at: string | null
}
Insert: {
can_select_worker: boolean
created_at?: string
email?: string | null
id: number
name: string
personal_code_required: boolean
phone_number?: string | null
updated_at?: string | null
}
Update: {
can_select_worker?: boolean
created_at?: string
email?: string | null
id?: number
name?: string
personal_code_required?: boolean
phone_number?: string | null
updated_at?: string | null
}
Relationships: []
}
connected_online_reservation: {
Row: {
booking_code: string
clinic_id: number
comments: string | null
created_at: string
discount_code: string | null
id: number
lang: string
requires_payment: boolean
service_id: number
service_user_id: number | null
start_time: string
sync_user_id: number
updated_at: string | null
user_id: string
}
Insert: {
booking_code: string
clinic_id: number
comments?: string | null
created_at?: string
discount_code?: string | null
id?: number
lang: string
requires_payment: boolean
service_id: number
service_user_id?: number | null
start_time: string
sync_user_id: number
updated_at?: string | null
user_id: string
}
Update: {
booking_code?: string
clinic_id?: number
comments?: string | null
created_at?: string
discount_code?: string | null
id?: number
lang?: string
requires_payment?: boolean
service_id?: number
service_user_id?: number | null
start_time?: string
sync_user_id?: number
updated_at?: string | null
user_id?: string
}
Relationships: []
}
connected_online_services: {
Row: {
clinic_id: number
code: string
created_at: string
description: string | null
display: string | null
duration: number
has_free_codes: boolean
id: number
name: string
neto_duration: number | null
online_hide_duration: number | null
online_hide_price: number | null
price: number
price_periods: string | null
requires_payment: boolean
sync_id: number
updated_at: string | null
}
Insert: {
clinic_id: number
code: string
created_at?: string
description?: string | null
display?: string | null
duration: number
has_free_codes: boolean
id: number
name: string
neto_duration?: number | null
online_hide_duration?: number | null
online_hide_price?: number | null
price: number
price_periods?: string | null
requires_payment: boolean
sync_id: number
updated_at?: string | null
}
Update: {
clinic_id?: number
code?: string
created_at?: string
description?: string | null
display?: string | null
duration?: number
has_free_codes?: boolean
id?: number
name?: string
neto_duration?: number | null
online_hide_duration?: number | null
online_hide_price?: number | null
price?: number
price_periods?: string | null
requires_payment?: boolean
sync_id?: number
updated_at?: string | null
}
Relationships: [
{
foreignKeyName: "connected_online_services_clinic_id_fkey"
columns: ["clinic_id"]
isOneToOne: false
referencedRelation: "connected_online_providers"
referencedColumns: ["id"]
},
]
}
invitations: {
Row: {
account_id: string
@@ -661,6 +856,63 @@ export type Database = {
},
]
}
nonces: {
Row: {
client_token: string
created_at: string
expires_at: string
id: string
last_verification_at: string | null
last_verification_ip: unknown | null
last_verification_user_agent: string | null
metadata: Json | null
nonce: string
purpose: string
revoked: boolean
revoked_reason: string | null
scopes: string[] | null
used_at: string | null
user_id: string | null
verification_attempts: number
}
Insert: {
client_token: string
created_at?: string
expires_at: string
id?: string
last_verification_at?: string | null
last_verification_ip?: unknown | null
last_verification_user_agent?: string | null
metadata?: Json | null
nonce: string
purpose: string
revoked?: boolean
revoked_reason?: string | null
scopes?: string[] | null
used_at?: string | null
user_id?: string | null
verification_attempts?: number
}
Update: {
client_token?: string
created_at?: string
expires_at?: string
id?: string
last_verification_at?: string | null
last_verification_ip?: unknown | null
last_verification_user_agent?: string | null
metadata?: Json | null
nonce?: string
purpose?: string
revoked?: boolean
revoked_reason?: string | null
scopes?: string[] | null
used_at?: string | null
user_id?: string | null
verification_attempts?: number
}
Relationships: []
}
notifications: {
Row: {
account_id: string
@@ -1058,6 +1310,17 @@ export type Database = {
updated_at: string
}
}
create_nonce: {
Args: {
p_user_id?: string
p_purpose?: string
p_expires_in_seconds?: number
p_metadata?: Json
p_scopes?: string[]
p_revoke_previous?: boolean
}
Returns: Json
}
create_team_account: {
Args: { account_name: string }
Returns: {
@@ -1110,6 +1373,10 @@ export type Database = {
Args: Record<PropertyKey, never>
Returns: Json
}
get_nonce_status: {
Args: { p_id: string }
Returns: Json
}
get_upper_system_role: {
Args: Record<PropertyKey, never>
Returns: string
@@ -1146,6 +1413,10 @@ export type Database = {
}
Returns: boolean
}
is_aal2: {
Args: Record<PropertyKey, never>
Returns: boolean
}
is_account_owner: {
Args: { account_id: string }
Returns: boolean
@@ -1154,14 +1425,26 @@ export type Database = {
Args: { target_account_id: string }
Returns: boolean
}
is_mfa_compliant: {
Args: Record<PropertyKey, never>
Returns: boolean
}
is_set: {
Args: { field_name: string }
Returns: boolean
}
is_super_admin: {
Args: Record<PropertyKey, never>
Returns: boolean
}
is_team_member: {
Args: { account_id: string; user_id: string }
Returns: boolean
}
revoke_nonce: {
Args: { p_id: string; p_reason?: string }
Returns: boolean
}
team_account_workspace: {
Args: { account_slug: string }
Returns: {
@@ -1236,6 +1519,18 @@ export type Database = {
updated_at: string
}
}
verify_nonce: {
Args: {
p_token: string
p_purpose: string
p_user_id?: string
p_required_scopes?: string[]
p_max_verification_attempts?: number
p_ip?: unknown
p_user_agent?: string
}
Returns: Json
}
}
Enums: {
analysis_order_status:
@@ -1383,6 +1678,7 @@ export type CompositeTypes<
export const Constants = {
audit: {
Enums: {
request_status: ["SUCCESS", "FAIL"],
sync_status: ["SUCCESS", "FAIL"],
},
},

View File

@@ -0,0 +1,227 @@
create table "public"."connected_online_providers" (
"id" bigint not null,
"name" text not null,
"email" text,
"phone_number" text,
"can_select_worker" boolean not null,
"personal_code_required" boolean not null,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp without time zone default now()
);
alter table "public"."connected_online_providers" enable row level security;
create table "public"."connected_online_services" (
"id" bigint not null,
"clinic_id" bigint not null,
"sync_id" bigint not null,
"name" text not null,
"description" text,
"price" double precision not null,
"requires_payment" boolean not null,
"duration" bigint not null,
"neto_duration" bigint,
"display" text,
"price_periods" text,
"online_hide_duration" bigint,
"online_hide_price" bigint,
"code" text not null,
"has_free_codes" boolean not null,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now()
);
alter table "public"."connected_online_services" enable row level security;
CREATE UNIQUE INDEX connected_online_providers_id_key ON public.connected_online_providers USING btree (id);
CREATE UNIQUE INDEX connected_online_providers_pkey ON public.connected_online_providers USING btree (id);
CREATE UNIQUE INDEX connected_online_services_id_key ON public.connected_online_services USING btree (id);
CREATE UNIQUE INDEX connected_online_services_pkey ON public.connected_online_services USING btree (id);
alter table "public"."connected_online_providers" add constraint "connected_online_providers_pkey" PRIMARY KEY using index "connected_online_providers_pkey";
alter table "public"."connected_online_services" add constraint "connected_online_services_pkey" PRIMARY KEY using index "connected_online_services_pkey";
alter table "public"."connected_online_providers" add constraint "connected_online_providers_id_key" UNIQUE using index "connected_online_providers_id_key";
alter table "public"."connected_online_services" add constraint "connected_online_services_clinic_id_fkey" FOREIGN KEY (clinic_id) REFERENCES connected_online_providers(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."connected_online_services" validate constraint "connected_online_services_clinic_id_fkey";
alter table "public"."connected_online_services" add constraint "connected_online_services_id_key" UNIQUE using index "connected_online_services_id_key";
grant delete on table "public"."connected_online_providers" to "service_role";
grant insert on table "public"."connected_online_providers" to "service_role";
grant references on table "public"."connected_online_providers" to "service_role";
grant select on table "public"."connected_online_providers" to "service_role";
grant trigger on table "public"."connected_online_providers" to "service_role";
grant truncate on table "public"."connected_online_providers" to "service_role";
grant update on table "public"."connected_online_providers" to "service_role";
grant select on table "public"."connected_online_providers" to "authenticated";
grant delete on table "public"."connected_online_services" to "service_role";
grant insert on table "public"."connected_online_services" to "service_role";
grant references on table "public"."connected_online_services" to "service_role";
grant select on table "public"."connected_online_services" to "service_role";
grant trigger on table "public"."connected_online_services" to "service_role";
grant truncate on table "public"."connected_online_services" to "service_role";
grant update on table "public"."connected_online_services" to "service_role";
grant select on table "public"."connected_online_services" to "authenticated";
create type "audit"."request_status" as enum ('SUCCESS', 'FAIL');
create table "audit"."request_entries" (
"id" bigint generated by default as identity not null,
"personal_code" bigint,
"request_api" text not null,
"request_api_method" text not null,
"status" audit.request_status not null,
"comment" text,
"service_provider_id" bigint,
"service_id" bigint,
"requested_start_date" timestamp with time zone,
"requested_end_date" timestamp with time zone,
"created_at" timestamp with time zone not null default now()
);
alter table "audit"."request_entries" enable row level security;
CREATE UNIQUE INDEX request_entries_pkey ON audit.request_entries USING btree (id);
alter table "audit"."request_entries" add constraint "request_entries_pkey" PRIMARY KEY using index "request_entries_pkey";
grant delete on table "audit"."request_entries" to "service_role";
grant insert on table "audit"."request_entries" to "service_role";
grant references on table "audit"."request_entries" to "service_role";
grant select on table "audit"."request_entries" to "service_role";
grant trigger on table "audit"."request_entries" to "service_role";
grant truncate on table "audit"."request_entries" to "service_role";
grant update on table "audit"."request_entries" to "service_role";
create policy "service_role_all"
on "audit"."request_entries"
as permissive
for all
to service_role
using (true);
create table "public"."connected_online_reservation" (
"id" bigint generated by default as identity not null,
"user_id" uuid not null,
"booking_code" text not null,
"service_id" bigint not null,
"clinic_id" bigint not null,
"service_user_id" bigint,
"sync_user_id" bigint not null,
"requires_payment" boolean not null,
"comments" text,
"start_time" timestamp with time zone not null,
"lang" text not null,
"discount_code" text,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now()
);
alter table "public"."connected_online_reservation" enable row level security;
CREATE UNIQUE INDEX connected_online_reservation_booking_code_key ON public.connected_online_reservation USING btree (booking_code);
CREATE UNIQUE INDEX connected_online_reservation_pkey ON public.connected_online_reservation USING btree (id);
alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_pkey" PRIMARY KEY using index "connected_online_reservation_pkey";
alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_booking_code_key" UNIQUE using index "connected_online_reservation_booking_code_key";
alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_user_id_fkey" FOREIGN KEY (user_id) REFERENCES auth.users(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."connected_online_reservation" validate constraint "connected_online_reservation_user_id_fkey";
grant delete on table "public"."connected_online_reservation" to "service_role";
grant insert on table "public"."connected_online_reservation" to "service_role";
grant references on table "public"."connected_online_reservation" to "service_role";
grant select on table "public"."connected_online_reservation" to "service_role";
grant trigger on table "public"."connected_online_reservation" to "service_role";
grant truncate on table "public"."connected_online_reservation" to "service_role";
grant update on table "public"."connected_online_reservation" to "service_role";
create policy "service_role_all"
on "public"."connected_online_reservation"
as permissive
for all
to service_role
using (true);
CREATE TRIGGER connected_online_providers_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_providers FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps();
CREATE TRIGGER connected_online_services_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_services FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps();
create policy "service_role_all"
on "public"."connected_online_providers"
as permissive
for all
to service_role
using (true);
create policy "service_role_all"
on "public"."connected_online_services"
as permissive
for all
to service_role
using (true);
create policy "authenticated_select"
on "public"."connected_online_providers"
as permissive
for select
to authenticated
using (true);
create policy "authenticated_select"
on "public"."connected_online_services"
as permissive
for select
to authenticated
using (true);
create policy "own_all"
on "public"."connected_online_reservation"
as permissive
for all
to authenticated
using ((( SELECT auth.uid() AS uid) = user_id));

View File

@@ -0,0 +1,225 @@
create table "public"."medreport_product_groups" (
"id" bigint generated by default as identity not null,
"name" text not null,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone
);
create table "public"."medreport_products" (
"id" bigint generated by default as identity not null,
"name" text not null,
"product_group_id" bigint,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now()
);
alter table "public"."medreport_products" enable row level security;
create table "public"."medreport_products_analyses_relations" (
"product_id" bigint not null,
"analysis_element_id" bigint,
"analysis_id" bigint
);
alter table "public"."medreport_product_groups" enable row level security;
alter table "public"."medreport_products_analyses_relations" enable row level security;
CREATE UNIQUE INDEX medreport_product_groups_name_key ON public.medreport_product_groups USING btree (name);
CREATE UNIQUE INDEX medreport_product_groups_pkey ON public.medreport_product_groups USING btree (id);
alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_pkey" PRIMARY KEY using index "medreport_product_groups_pkey";
alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_name_key" UNIQUE using index "medreport_product_groups_name_key";
alter table "public"."medreport_products" add constraint "medreport_products_product_groups_id_fkey" FOREIGN KEY (product_group_id) REFERENCES medreport_product_groups(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products" validate constraint "medreport_products_product_groups_id_fkey";
grant select on table "public"."medreport_product_groups" to "anon";
grant select on table "public"."medreport_product_groups" to "authenticated";
grant delete on table "public"."medreport_product_groups" to "service_role";
grant insert on table "public"."medreport_product_groups" to "service_role";
grant references on table "public"."medreport_product_groups" to "service_role";
grant select on table "public"."medreport_product_groups" to "service_role";
grant trigger on table "public"."medreport_product_groups" to "service_role";
grant truncate on table "public"."medreport_product_groups" to "service_role";
grant update on table "public"."medreport_product_groups" to "service_role";
CREATE UNIQUE INDEX medreport_products_analyses_analysis_element_id_key ON public.medreport_products_analyses_relations USING btree (analysis_element_id);
CREATE UNIQUE INDEX medreport_products_analyses_analysis_id_key ON public.medreport_products_analyses_relations USING btree (analysis_id);
CREATE UNIQUE INDEX medreport_products_analyses_pkey ON public.medreport_products_analyses_relations USING btree (product_id);
CREATE UNIQUE INDEX medreport_products_name_key ON public.medreport_products USING btree (name);
CREATE UNIQUE INDEX medreport_products_pkey ON public.medreport_products USING btree (id);
alter table "public"."medreport_products" add constraint "medreport_products_pkey" PRIMARY KEY using index "medreport_products_pkey";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_pkey" PRIMARY KEY using index "medreport_products_analyses_pkey";
alter table "public"."medreport_products" add constraint "medreport_products_name_key" UNIQUE using index "medreport_products_name_key";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_fkey" FOREIGN KEY (analysis_element_id) REFERENCES analysis_elements(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_element_id_fkey";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_key" UNIQUE using index "medreport_products_analyses_analysis_element_id_key";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_fkey" FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_id_fkey";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_key" UNIQUE using index "medreport_products_analyses_analysis_id_key";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_product_id_fkey";
alter table "public"."medreport_products_analyses_relations" add constraint "product_can_be_tied_to_only_one_external_item" CHECK (((analysis_id IS NULL) OR (analysis_element_id IS NULL))) not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_external_item";
grant select on table "public"."medreport_products" to "anon";
grant select on table "public"."medreport_products" to "authenticated";
grant delete on table "public"."medreport_products" to "service_role";
grant insert on table "public"."medreport_products" to "service_role";
grant references on table "public"."medreport_products" to "service_role";
grant select on table "public"."medreport_products" to "service_role";
grant trigger on table "public"."medreport_products" to "service_role";
grant truncate on table "public"."medreport_products" to "service_role";
grant update on table "public"."medreport_products" to "service_role";
grant select on table "public"."medreport_products_analyses_relations" to "anon";
grant select on table "public"."medreport_products_analyses_relations" to "authenticated";
grant delete on table "public"."medreport_products_analyses_relations" to "service_role";
grant insert on table "public"."medreport_products_analyses_relations" to "service_role";
grant references on table "public"."medreport_products_analyses_relations" to "service_role";
grant select on table "public"."medreport_products_analyses_relations" to "service_role";
grant trigger on table "public"."medreport_products_analyses_relations" to "service_role";
grant truncate on table "public"."medreport_products_analyses_relations" to "service_role";
grant update on table "public"."medreport_products_analyses_relations" to "service_role";
create policy "Enable read access for all users"
on "public"."medreport_products_analyses_relations"
as permissive
for select
to public
using (true);
ALTER TABLE medreport_products_analyses_relations
ADD CONSTRAINT product_can_be_tied_to_only_one_analysis_item
CHECK (analysis_id IS NULL OR analysis_element_id IS NULL);
create table "public"."medreport_products_external_services_relations" (
"product_id" bigint not null,
"connected_online_service_id" bigint not null
);
alter table "public"."medreport_products_external_services_relations" enable row level security;
CREATE UNIQUE INDEX medreport_products_connected_online_services_id_key ON public.medreport_products_external_services_relations USING btree (connected_online_service_id);
CREATE UNIQUE INDEX medreport_products_connected_online_services_pkey ON public.medreport_products_external_services_relations USING btree (connected_online_service_id);
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_pkey" PRIMARY KEY using index "medreport_products_connected_online_services_pkey";
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_fkey" FOREIGN KEY (connected_online_service_id) REFERENCES connected_online_services(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_id_fkey";
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_key" UNIQUE using index "medreport_products_connected_online_services_id_key";
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_product_id_fkey";
grant select on table "public"."medreport_products_external_services_relations" to "anon";
grant select on table "public"."medreport_products_external_services_relations" to "authenticated";
grant delete on table "public"."medreport_products_external_services_relations" to "service_role";
grant insert on table "public"."medreport_products_external_services_relations" to "service_role";
grant references on table "public"."medreport_products_external_services_relations" to "service_role";
grant select on table "public"."medreport_products_external_services_relations" to "service_role";
grant trigger on table "public"."medreport_products_external_services_relations" to "service_role";
grant truncate on table "public"."medreport_products_external_services_relations" to "service_role";
grant update on table "public"."medreport_products_external_services_relations" to "service_role";
CREATE OR REPLACE FUNCTION check_tied_to_connected_online()
RETURNS TRIGGER AS $$
BEGIN
IF EXISTS (
SELECT 1
FROM medreport_products_external_services_relations
WHERE product_id = NEW.product_id
) THEN
RAISE EXCEPTION 'Value "%" already exists in medreport_products_external_services_relations', NEW.product_id;
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION check_tied_to_analysis_item()
RETURNS TRIGGER AS $$
BEGIN
IF EXISTS (
SELECT 1
FROM medreport_products_analyses_relations
WHERE product_id = NEW.product_id
) THEN
RAISE EXCEPTION 'Value "%" already exists in medreport_products_analyses_relations', NEW.product_id;
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER check_not_already_tied_to_connected_online BEFORE INSERT OR UPDATE ON public.medreport_products_analyses_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_connected_online();
CREATE TRIGGER check_not_already_tied_to_analysis BEFORE INSERT OR UPDATE ON public.medreport_products_external_services_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_analysis_item();
create policy "read_all"
on "public"."medreport_product_groups"
as permissive
for select
to public
using (true);