sms entegrasyonu ve ana sayfa işlemleri
This commit is contained in:
35
supabase_schema_customers.sql
Normal file
35
supabase_schema_customers.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Create customers table
|
||||
CREATE TABLE IF NOT EXISTS customers (
|
||||
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
full_name TEXT NOT NULL,
|
||||
email TEXT,
|
||||
phone TEXT,
|
||||
address TEXT,
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL
|
||||
);
|
||||
|
||||
-- Enable Row Level Security
|
||||
ALTER TABLE customers ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Policies
|
||||
-- 1. Admin read access
|
||||
CREATE POLICY "Admins can view customers"
|
||||
ON customers FOR SELECT
|
||||
USING (auth.role() = 'authenticated');
|
||||
|
||||
-- 2. Admin insert access
|
||||
CREATE POLICY "Admins can insert customers"
|
||||
ON customers FOR INSERT
|
||||
WITH CHECK (auth.role() = 'authenticated');
|
||||
|
||||
-- 3. Admin update access
|
||||
CREATE POLICY "Admins can update customers"
|
||||
ON customers FOR UPDATE
|
||||
USING (auth.role() = 'authenticated');
|
||||
|
||||
-- 4. Admin delete access
|
||||
CREATE POLICY "Admins can delete customers"
|
||||
ON customers FOR DELETE
|
||||
USING (auth.role() = 'authenticated');
|
||||
Reference in New Issue
Block a user