about summary refs log tree commit diff
path: root/supabase/migrations/20240605214222_create_api_key_table.sql
blob: ece2226eb5a1cfcd911ef95cedcda26618d30a13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
CREATE TABLE IF NOT EXISTS public."api_key" (
  user_id UUID NOT NULL REFERENCES auth.users,
  api_key CHAR(44) NOT NULL
);

ALTER TABLE public."api_key" ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Restrict access to user api keys to their own api keys"
	ON public."api_key"
	FOR SELECT
	TO authenticated
	USING (user_id = auth.uid());