Skip to content

Commit f395106

Browse files
committed
Added comment about generating the typescript types
1 parent e7862a8 commit f395106

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/examples/supabase-database-operations.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ This is a basic task which inserts a new row into a table from a Trigger.dev tas
2525
```ts trigger/supabase-database-insert.ts
2626
import { createClient } from "@supabase/supabase-js";
2727
import { task } from "@trigger.dev/sdk/v3";
28+
// Generate the Typescript types using the Supabase CLI: https://supabase.com/docs/guides/api/rest/generating-types
2829
import { Database } from "database.types";
2930

3031
// Create a single Supabase client for interacting with your database
32+
// 'Database' supplies the type definitions to supabase-js
3133
const supabase = createClient<Database>(
3234
// These details can be found in your Supabase project settings under `API`
3335
process.env.SUPABASE_PROJECT_URL as string, // e.g. https://abc123.supabase.co - replace 'abc123' with your project ID
@@ -93,6 +95,7 @@ This type of task is useful for managing user subscriptions, updating user detai
9395
- A [Supabase account](https://supabase.com/dashboard/) and a project set up
9496
- In your Supabase project, create a table called `user_subscriptions` (if you haven't already)
9597
- In your `user_subscriptions` table, create these columns (if they don't already exist):
98+
9699
- `user_id`, with the data type: `text`
97100
- `plan`, with the data type: `text`
98101
- `updated_at`, with the data type: `timestamptz`
@@ -102,12 +105,14 @@ This type of task is useful for managing user subscriptions, updating user detai
102105
```ts trigger/supabase-update-user-subscription.ts
103106
import { createClient } from "@supabase/supabase-js";
104107
import { AbortTaskRunError, task } from "@trigger.dev/sdk/v3";
108+
// Generate the Typescript types using the Supabase CLI: https://supabase.com/docs/guides/api/rest/generating-types
105109
import { Database } from "database.types";
106110

107111
// Define the allowed plan types
108112
type PlanType = "hobby" | "pro" | "enterprise";
109113

110114
// Create a single Supabase client for interacting with your database
115+
// 'Database' supplies the type definitions to supabase-js
111116
const supabase = createClient<Database>(
112117
// These details can be found in your Supabase project settings under `API`
113118
process.env.SUPABASE_PROJECT_URL as string, // e.g. https://abc123.supabase.co - replace 'abc123' with your project ID

0 commit comments

Comments
 (0)