Skip to content

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

Studio: Add quickstarts instruments example to dashboard examples (#47402)

Chris Chinchilla16ce2c1a8a17
diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.queries.ts b/apps/studio/components/interfaces/SQLEditor/SQLEditor.queries.ts
index 2f42bc16365..bff40b0a25d 100644
--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.queries.ts
+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.queries.ts
@@ -1600,4 +1600,37 @@ grant execute on function public.custom_access_token_hook to supabase_auth_admin
revoke execute on function public.custom_access_token_hook from authenticated, anon, public;
`,
},
+ {
+ id: 30,
+ type: 'quickstart',
+ title: 'Instruments',
+ description:
+ 'Create an instruments table with sample data and Row Level Security, as used in the framework quickstarts.',
+ sql: `
+-- Create the table
+create table instruments (
+ id bigint primary key generated always as identity,
+ name text not null
+);
+
+-- Insert sample data into the table
+insert into instruments (name)
+values
+ ('violin'),
+ ('viola'),
+ ('cello');
+
+-- Grant the privileges the role needs, which is read access
+grant select on public.instruments to anon;
+
+-- Enable row level security for the table
+alter table instruments enable row level security;
+
+-- Create a policy to allow the anon role to read from the instruments table
+create policy "public can read instruments"
+on public.instruments
+for select to anon
+using (true);
+`.trim(),
+ },
]