The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Adds a simple section for Extensions
Paul Copplestoneee715cb819f0
diff --git a/web/docs/guides/database/extensions.mdx b/web/docs/guides/database/extensions.mdxnew file mode 100644index 00000000000..4e919df0d6f--- /dev/null+++ b/web/docs/guides/database/extensions.mdx@@ -0,0 +1,66 @@+---+id: extensions+title: Overview+description: Using Postgres extensions.+---++import ExtensionsComponent from '../../../src/components/Extensions'+import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';++Extensions are exactly as they sound - they "extend" the database with functionality which isn't part of the Postgres core.+Supabase has pre-installed some of the most useful open source extensions.+++### Enable and disable extensions++++<Tabs+defaultValue="UI"+values={[+ {label: 'UI', value: 'UI'},+ {label: 'SQL', value: 'SQL'},+]}>+<TabItem value="UI">++```bash+1. Go to the Database page+2. Click on "Extensions" in the sidebar+3. Find the extension you would like to enable/disable+4. Click the toggle.+```+++<video width="99%" muted playsInline controls={true}>+<source src="/videos/toggle-extensions.mp4" type="video/mp4" muted playsInline />+</video>++++</TabItem>+<TabItem value="SQL">++```sql++-- Example: enable the "pgtap" extension+create extenstion pgtap;++-- Example: disable the "pgtap" extension+drop extenstion pgtap;++```++Even though the SQL code is `create extension`, this is the equivelent of "enabling the extension".+To disable an extension you can call `drop extension`.++</TabItem>++</Tabs>+++### Full list of extensions++Supabase is pre-configured with over 50 extensions. You can also install your own SQL extensions directly into the database through our SQL editor.++<ExtensionsComponent />diff --git a/web/docs/guides/database/extensions/pgtap.mdx b/web/docs/guides/database/extensions/pgtap.mdxnew file mode 100644index 00000000000..46118b036b8--- /dev/null+++ b/web/docs/guides/database/extensions/pgtap.mdx@@ -0,0 +1,130 @@+---+id: pgtap+title: "pgTAP: Unit Testing"+description: Unit testing in PostgreSQL.+---++import ExtensionsComponent from '../../../../src/components/Extensions'+import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';++`pgTAP` is a unit testing extension for PostgreSQL.++## Overview++Before showing you how to write tests, let's cover some basic concepts:++- Unit tests: allow you to test small parts of a system (like a database table!).+- TAP: stands for [Test Anything Protocol](http://testanything.org/). It is an framework which aims to simplify the error reporting during testing.++++## Usage+++### Enabling pgTAP++++<Tabs+defaultValue="UI"+values={[+ {label: 'UI', value: 'UI'},+ {label: 'SQL', value: 'SQL'},+]}>+<TabItem value="UI">++```bash+1. Go to the Database page+2. Click on "Extensions" in the sidebar+3. Find the extension you would like to enable/disable+4. Click the toggle.+```+++<video width="99%" muted playsInline controls={true}>+<source src="/videos/toggle-extensions.mp4" type="video/mp4" muted playsInline />+</video>++++</TabItem>+<TabItem value="SQL">++```sql++-- Example: enable the "pgtap" extension+create extenstion pgtap;++-- Example: disable the "pgtap" extension+drop extenstion pgtap;++```++Even though the SQL code is `create extension`, this is the equivelent of "enabling the extension".+To disable an extension you can call `drop extension`.++</TabItem>++</Tabs>+++### Creating a test+++@TODO++- Create a plan+- We should come up with a recommendation on how to run the tests. Via a function? External scripts?+- Eventually this can be done via our CLI+++### Running a test++@TODO+++## Examples++Let's look at a few different tests which could be helpful in your project.+++### Testing tables+++```sql+begin;+select plan( 1 );++select has_table( 'profiles' );++select * from finish();+rollback;+```++API:++- [`hasTable()`](https://pgtap.org/documentation.html#has_table)+++### Testing columns++```sql+begin;+select plan( 1 );++select has_column( 'profiles', 'id' );+select col_is_pk( 'profiles', 'id' );++select * from finish();+rollback;+```++API:++- [`has_column()`](https://pgtap.org/documentation.html#has_column)+- [`col_is_pk()`](https://pgtap.org/documentation.html#col_is_pk)++## Resources++- Official [`pgTAP` documentation](https://pgtap.org/).\ No newline at end of filediff --git a/web/docusaurus.config.js b/web/docusaurus.config.jsindex 377958724cb..35bcfafd337 100755--- a/web/docusaurus.config.js+++ b/web/docusaurus.config.js@@ -73,12 +73,12 @@ module.exports = {activeBaseRegex: '(^/docs$)|(/docs/faq)',position: 'left',},- // {- // label: 'Guides',- // to: '/docs/guides',- // activeBaseRegex: '(/docs/guides)',- // position: 'left',- // },+ {+ label: 'Guides',+ to: '/docs/guides',+ activeBaseRegex: '(/docs/guides)',+ position: 'left',+ },{label: 'Reference',to: '/docs/reference/javascript/supabase-client',diff --git a/web/sidebars.js b/web/sidebars.jsindex aeb10b8a0c1..f8375529815 100755--- a/web/sidebars.js+++ b/web/sidebars.js@@ -82,18 +82,20 @@ module.exports = {type: 'category',label: 'Guides',collapsed: false,- items: ['guides/examples', 'guides/with-nextjs', 'guides/with-react', 'guides/with-svelte', 'guides/with-vue-3' ,'guides/self-hosting'],+ items: [+ 'guides/examples',+ 'guides/with-nextjs',+ 'guides/with-react',+ 'guides/with-svelte',+ 'guides/with-vue-3',+ 'guides/self-hosting',+ ],},{type: 'category',label: 'See Also',collapsed: false,- items: [- 'handbook/contributing',- 'company/terms',- 'company/privacy',- 'company/aup',- ],+ items: ['handbook/contributing', 'company/terms', 'company/privacy', 'company/aup'],},],guides: [@@ -108,16 +110,16 @@ module.exports = {label: 'Database',collapsed: false,items: [- 'guides/database/arrays',- 'guides/database/json',+ 'guides/database/arrays',+ 'guides/database/json','guides/database/password-reset','guides/database/sql-to-api',- // {- // type: 'category',- // label: 'SQL Tutorial',- // collapsed: false,- // items: ['guides/database/arrays'],- // },+ {+ type: 'category',+ label: 'Extensions',+ collapsed: false,+ items: ['guides/database/extensions', 'guides/database/extensions/pgtap'],+ },],},{@@ -125,12 +127,12 @@ module.exports = {label: 'Auth',collapsed: false,items: [- 'guides/auth/auth-apple',+ 'guides/auth/auth-apple','guides/auth/auth-bitbucket',- 'guides/auth/auth-facebook',- 'guides/auth/auth-github',+ 'guides/auth/auth-facebook',+ 'guides/auth/auth-github','guides/auth/auth-gitlab',- 'guides/auth/auth-google',+ 'guides/auth/auth-google','guides/auth/auth-twitter',],},