MED-103: add booking functionality
This commit is contained in:
11
supabase/migrations/20250908092531_add_clinic_key.sql
Normal file
11
supabase/migrations/20250908092531_add_clinic_key.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
ALTER TABLE medreport.connected_online_providers ADD COLUMN key text not null DEFAULT ''; -- avoid conflict with already existing data, will be filled on next sync
|
||||
ALTER TABLE medreport.connected_online_providers
|
||||
ALTER key DROP DEFAULT;
|
||||
|
||||
ALTER TABLE medreport.connected_online_providers ADD COLUMN address text not null DEFAULT '';
|
||||
ALTER TABLE medreport.connected_online_providers
|
||||
ALTER key DROP DEFAULT;
|
||||
|
||||
ALTER TABLE medreport.connected_online_services
|
||||
ALTER COLUMN sync_id TYPE bigint
|
||||
USING sync_id::bigint;
|
||||
@@ -0,0 +1,60 @@
|
||||
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() references auth.users(id);
|
||||
|
||||
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);
|
||||
@@ -0,0 +1,14 @@
|
||||
ALTER TABLE medreport.connected_online_reservation
|
||||
ADD COLUMN medusa_cart_line_item_id TEXT references public.cart_line_item(id);
|
||||
|
||||
ALTER TABLE medreport.connected_online_reservation
|
||||
ADD COLUMN location_sync_id bigint;
|
||||
|
||||
create type medreport.connected_online_order_status as enum ('PENDING', 'CONFIRMED', 'REJECTED', 'CANCELLED');
|
||||
|
||||
ALTER TABLE medreport.connected_online_reservation
|
||||
ADD COLUMN status medreport.connected_online_order_status not null;
|
||||
|
||||
ALTER TABLE medreport.connected_online_reservation ALTER COLUMN booking_code DROP NOT NULL;
|
||||
ALTER TABLE medreport.connected_online_reservation ALTER COLUMN requires_payment DROP NOT NULL;
|
||||
ALTER TABLE medreport.connected_online_reservation ALTER COLUMN service_user_id SET NOT NULL;
|
||||
@@ -0,0 +1,43 @@
|
||||
create table "medreport"."connected_online_locations" (
|
||||
"id" bigint generated by default as identity not null,
|
||||
"sync_id" bigint not null,
|
||||
"name" text not null,
|
||||
"address" text,
|
||||
"clinic_id" bigint not null REFERENCES medreport.connected_online_providers(id),
|
||||
"created_at" timestamp with time zone not null default now(),
|
||||
"updated_at" timestamp without time zone default now()
|
||||
);
|
||||
|
||||
alter table "medreport"."connected_online_locations" enable row level security;
|
||||
|
||||
create policy "service_role_all"
|
||||
on "medreport"."connected_online_locations"
|
||||
as permissive
|
||||
for all
|
||||
to service_role
|
||||
using (true);
|
||||
|
||||
|
||||
grant delete on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant insert on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant references on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant select on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant trigger on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant truncate on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant update on table "medreport"."connected_online_locations" to "service_role";
|
||||
|
||||
grant select on table "medreport"."connected_online_locations" to "authenticated";
|
||||
|
||||
|
||||
create policy "authenticated_select"
|
||||
on "medreport"."connected_online_locations"
|
||||
as permissive
|
||||
for select
|
||||
to authenticated
|
||||
using (true);
|
||||
Reference in New Issue
Block a user