From 1303c97f728b901112eca2f6e3afce5a0d5d606b Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:22:03 +0100 Subject: [PATCH] docs(#14): Add type generation docs --- docs/database-setup.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/database-setup.md b/docs/database-setup.md index c874754..7893d1b 100644 --- a/docs/database-setup.md +++ b/docs/database-setup.md @@ -163,3 +163,17 @@ drop publication if exists supabase_realtime; create publication supabase_realtime for table products, prices; ``` + +To get the types for the tables, you can follow these instructions taken from [here](https://supabase.com/docs/guides/api/rest/generating-types#generating-types-using-supabase-cli): + +`npm i supabase@">=1.8.1" --save-dev` + +`npx supabase login` + +`npx supabase init` + +Replace `$PROJECT_REF` with your project reference: +`npx supabase gen types typescript --project-id "$PROJECT_REF" --schema public > types/supabase.ts` + +Replace `types/supabase.d.ts` with whatever file you want your types in: +`npx supabase gen types typescript --local > types/supabase.d.ts`