From 3129144c816aedf51aadf2cfd9b29385efbcae1b Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Mon, 7 Aug 2023 21:55:24 +0200 Subject: [PATCH] formats documnet --- .../docs/pages/guides/cli/seeding-your-database.mdx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/docs/pages/guides/cli/seeding-your-database.mdx b/apps/docs/pages/guides/cli/seeding-your-database.mdx index 9af5f53a6df..e704e90c757 100644 --- a/apps/docs/pages/guides/cli/seeding-your-database.mdx +++ b/apps/docs/pages/guides/cli/seeding-your-database.mdx @@ -32,6 +32,7 @@ values {/* prettier-ignore */} {/* + ### Splitting up your seed file The seed file can grow quite large, so you can split it up into multiple files. For example, you can create a `seed` folder and add a `countries.sql` file. Then you can add the following to your `seed.sql` file. @@ -48,6 +49,7 @@ You can use the `COPY` command to import CSV data into your database. For exampl ```sql supabase/seed.sql COPY countries (name, code) FROM 'seed/countries.csv' WITH (FORMAT csv); ``` + \*/} ## Generating seed data @@ -60,9 +62,9 @@ Let's generate some seed data for a typical blog application, with the following We can use the Snaplet configuration file to define the values you want to generate. For example -* A `Post` with the title `"There is a lot of snow around here!"` -* The `Post.createdBy` user with an email address ending in `"@acme.org"` -* Three `Post.comments` from three different users. +- A `Post` with the title `"There is a lot of snow around here!"` +- The `Post.createdBy` user with an email address ending in `"@acme.org"` +- Three `Post.comments` from three different users. ```ts snaplet.config.ts defineConfig({ @@ -88,14 +90,14 @@ defineConfig({ Running `npx snaplet generate --sql > supabase/seed.sql` would generate these relevant SQL statements inside our `supabase/seed.sql` file: -```sql +```sql -- The `Post.createdBy` user with an email address ending in `"@acme.org"` INSERT INTO "User" (name, email) VALUES ("John Snow", "snow@acme.org") --- A `Post` with the title `"There is a lot of snow around here!"` INSERT INTO "Post" (title, content, createdBy) VALUES ( "There is a lot of snow around here!", - "Lorem ipsum dolar", + "Lorem ipsum dolar", 1) --- Three `Post.comments` from three different users. @@ -109,7 +111,6 @@ INSERT INTO "User" (name, email) VALUES ("Steven Plank", "s@plank.org") INSERT INTO "Comment" (text, userId, postId) VALUES ("Actually, that's not correct...", 4, 1) ``` - For more information, check out Snaplet's ["generate" documentation](https://docs.snaplet.dev/references/data-operations/generate) export const Page = ({ children }) =>