Skip to content

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

Move and refactor constants

Terry Suttonff0caabe4ca9
diff --git a/packages/ui/src/components/Command/Command.constants.ts b/packages/ui/src/components/Command/Command.constants.ts
index a82feca5f68..72e8892a6ce 100644
--- a/packages/ui/src/components/Command/Command.constants.ts
+++ b/packages/ui/src/components/Command/Command.constants.ts
@@ -6,3 +6,49 @@ export const COMMAND_ROUTES = {
AI_ASK_ANYTHING: 'Ask anything',
AI_RLS_POLICY: 'Help me create a RLS policy',
}
+
+type QueryCategory = {
+ category: string
+ queries: string[]
+}
+
+type SampleQueries = QueryCategory[]
+
+export const SAMPLE_QUERIES: SampleQueries = [
+ {
+ category: 'Create tables',
+ queries: [
+ 'Create a table that stores a list of cities, and insert 10 rows of sample data into it',
+ 'Create tables (with foreign key relationships) for blog posts and comments',
+ ],
+ },
+ {
+ category: 'Create views',
+ queries: [
+ 'Create a view that shows the total revenue for each customer',
+ 'Create a view that shows all orders that were placed in the last week',
+ 'Create a view that shows all products that are currently out of stock',
+ ],
+ },
+ {
+ category: 'Select data',
+ queries: [
+ 'Retrieve a list of employees from the employees table who have a salary greater than $50,000',
+ 'Retrieve the department and average salary of each department from the employees table, group by department',
+ ],
+ },
+ {
+ category: 'Triggers',
+ queries: [
+ 'Create a trigger that updates the updated_at column on the orders table with the current time when the row of the orders table is updated',
+ ],
+ },
+ {
+ category: 'Row level security',
+ queries: [
+ 'Create an RLS policy that grants only authenticated access to the profiles table',
+ 'Create an RLS policy that grants SELECT access to the sales_rep role for the customers table, but denies access to all other roles',
+ "Create an RLS policy that grants INSERT access access to the manager role for the employees table, but only for rows where the employee's department_id matches a list of departments that the manager is responsible for",
+ ],
+ },
+]