blob: 634c8f05e12bce56adf24478fa01714563fd29dc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
CREATE TABLE IF NOT EXISTS public."restored_file" (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID NOT NULL,
absolute_path VARCHAR(4096) NOT NULL,
contents TEXT,
timestamp TIMESTAMPTZ NOT NULL
);
ALTER TABLE public."restored_file" ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Restrict access to user files to their own files"
ON public."restored_file"
FOR SELECT
TO authenticated
USING (user_id = auth.uid());
CREATE POLICY "Users can create a profile."
ON public."restored_file"
FOR INSERT
TO authenticated
WITH CHECK (auth.uid() = user_id);
|