Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update sql query

Hieu Vu808256abc756
diff --git a/apps/docs/components/MDX/product_management_sql_template.mdx b/apps/docs/components/MDX/product_management_sql_template.mdx
index e728bc67b91..ed2a6d087bc 100644
--- a/apps/docs/components/MDX/product_management_sql_template.mdx
+++ b/apps/docs/components/MDX/product_management_sql_template.mdx
@@ -1,41 +1,35 @@
```sql
-- Create a table for public profiles
-create table products (
- id uuid references auth.users not null primary key,
- updated_at timestamp with time zone,
- username text unique,
- full_name text,
- avatar_url text,
- website text,
- constraint username_length check (char_length(username) >= 3)
-);
--- Set up Row Level Security (RLS)
--- See https://supabase.com/docs/guides/auth/row-level-security for more details.
-alter table products
- enable row level security;
-
-create policy "Public profiles are viewable by everyone." on profiles
- for select using (true);
-
-create policy "Users can insert their own profile." on profiles
- for insert with check (auth.uid() = id);
-
-create policy "Users can update own profile." on profiles
- for update using (auth.uid() = id);
+create table
+ public.products (
+ id uuid not null default gen_random_uuid (),
+ name text not null,
+ price real not null,
+ image text null,
+ constraint products_pkey primary key (id)
+ ) tablespace pg_default;
-- Set up Storage!
insert into storage.buckets (id, name)
- values ('products', 'products');
+ values ('Product Image', 'Product Image');
-- Set up access controls for storage.
-- See https://supabase.com/docs/guides/storage#policy-examples for more details.
-create policy "Avatar images are publicly accessible." on storage.objects
- for select using (bucket_id = 'products');
-
-create policy "Anyone can upload an avatar." on storage.objects
- for insert with check (bucket_id = 'products');
-
-create policy "Anyone can update their own avatar." on storage.objects
- for update using (auth.uid() = owner) with check (bucket_id = 'products');
-```
+CREATE POLICY "Enable read access for all users" ON "storage"."objects"
+AS PERMISSIVE FOR SELECT
+TO public
+USING (true)
+
+CREATE POLICY "Enable insert for all users" ON "storage"."objects"
+AS PERMISSIVE FOR INSERT
+TO authenticated, anon
+WITH CHECK (true)
+
+CREATE POLICY "Enable update for all users" ON "storage"."objects"
+AS PERMISSIVE FOR UPDATE
+TO public
+USING (true)
+WITH CHECK (true)
+
+```
\ No newline at end of file