添加首页加载skeleton
This commit is contained in:
@@ -79,6 +79,7 @@ ALTER TABLE public.ml_delivery_staff ENABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE public.ml_delivery_stations ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
DROP POLICY IF EXISTS delivery_staff_self_select ON public.ml_delivery_staff;
|
||||
DROP POLICY IF EXISTS delivery_staff_self_update ON public.ml_delivery_staff;
|
||||
CREATE POLICY delivery_staff_self_select
|
||||
ON public.ml_delivery_staff
|
||||
FOR SELECT
|
||||
@@ -93,6 +94,29 @@ CREATE POLICY delivery_staff_self_select
|
||||
)
|
||||
);
|
||||
|
||||
CREATE POLICY delivery_staff_self_update
|
||||
ON public.ml_delivery_staff
|
||||
FOR UPDATE
|
||||
TO authenticated
|
||||
USING (
|
||||
deleted_at IS NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM public.ak_users u
|
||||
WHERE u.id = ml_delivery_staff.uid
|
||||
AND u.auth_id = auth.uid()
|
||||
)
|
||||
)
|
||||
WITH CHECK (
|
||||
deleted_at IS NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM public.ak_users u
|
||||
WHERE u.id = ml_delivery_staff.uid
|
||||
AND u.auth_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
DROP POLICY IF EXISTS delivery_stations_select_active ON public.ml_delivery_stations;
|
||||
CREATE POLICY delivery_stations_select_active
|
||||
ON public.ml_delivery_stations
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
begin;
|
||||
|
||||
alter table if exists public.ak_users
|
||||
drop constraint if exists ak_users_preferred_language_fkey;
|
||||
|
||||
alter table if exists public.ak_users
|
||||
add constraint ak_users_preferred_language_fkey
|
||||
foreign key (preferred_language)
|
||||
references public.ak_languages (id)
|
||||
on update cascade
|
||||
on delete set null;
|
||||
|
||||
create index if not exists idx_ak_users_preferred_language
|
||||
on public.ak_users (preferred_language);
|
||||
|
||||
alter table if exists public.ak_languages enable row level security;
|
||||
|
||||
do $$
|
||||
begin
|
||||
if exists (
|
||||
select 1
|
||||
from pg_class c
|
||||
join pg_namespace n on n.oid = c.relnamespace
|
||||
where n.nspname = 'public'
|
||||
and c.relname = 'ak_languages'
|
||||
and c.relkind = 'r'
|
||||
) and not exists (
|
||||
select 1
|
||||
from pg_policies
|
||||
where schemaname = 'public'
|
||||
and tablename = 'ak_languages'
|
||||
and policyname = 'ak_languages_active_select'
|
||||
) then
|
||||
create policy ak_languages_active_select
|
||||
on public.ak_languages
|
||||
for select
|
||||
using (is_active = true);
|
||||
end if;
|
||||
end
|
||||
$$;
|
||||
|
||||
commit;
|
||||
Reference in New Issue
Block a user