38980-vm/app-9w9pd00g5j41/supabase/migrations/00075_create_api_keys_table_fixed.sql
2026-03-04 18:25:09 +00:00

19 lines
615 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- API Anahtarları Tablosu
CREATE TABLE IF NOT EXISTS public.admin_api_keys (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
key TEXT NOT NULL UNIQUE,
value TEXT NOT NULL,
description TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT now()
);
-- RLS Etkinleştir
ALTER TABLE public.admin_api_keys ENABLE ROW LEVEL SECURITY;
-- Politikalar
-- use is_admin() instead of is_admin(auth.uid()) as per definition
CREATE POLICY "Admins have full access to api keys" ON public.admin_api_keys
FOR ALL TO authenticated
USING (is_admin());