create table "medreport"."connected_online_service_providers" (
    "id" bigint not null primary key,
    "name" text not null,
    "spoken_languages" text[],
    "prefix" text,
    "job_title_et" text,
    "job_title_en" text,
    "job_title_ru" text,
    "clinic_id" bigint not null REFERENCES medreport.connected_online_providers(id),
    "job_title_id" bigint,
    "is_deleted" boolean,
    "created_at" timestamp with time zone not null default now(),
    "updated_at" timestamp without time zone default now()
);

ALTER TABLE audit.request_entries
DROP COLUMN personal_code;

ALTER TABLE audit.request_entries ADD COLUMN user_id uuid default auth.uid();

create policy "insert_own"
on "audit"."request_entries"
as permissive
for insert
to authenticated
with check ((( SELECT auth.uid() AS uid) = user_id));

alter table "medreport"."connected_online_service_providers" enable row level security;

create policy "service_role_all"
on "medreport"."connected_online_service_providers"
as permissive
for all
to service_role
using (true);


grant delete on table "medreport"."connected_online_service_providers" to "service_role";

grant insert on table "medreport"."connected_online_service_providers" to "service_role";

grant references on table "medreport"."connected_online_service_providers" to "service_role";

grant select on table "medreport"."connected_online_service_providers" to "service_role";

grant trigger on table "medreport"."connected_online_service_providers" to "service_role";

grant truncate on table "medreport"."connected_online_service_providers" to "service_role";

grant update on table "medreport"."connected_online_service_providers" to "service_role";

grant select on table "medreport"."connected_online_service_providers" to "authenticated";


create policy "authenticated_select"
on "medreport"."connected_online_service_providers"
as permissive
for select
to authenticated
using (true);
