Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed docs/assets/favicon.ico
Binary file not shown.
35 changes: 0 additions & 35 deletions docs/index.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/requirements_docs.txt

This file was deleted.

38 changes: 0 additions & 38 deletions mkdocs.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# fumadocs
.source
4 changes: 4 additions & 0 deletions website/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { source } from '@/lib/source'
import { createFromSource } from 'fumadocs-core/search/server'

export const { GET } = createFromSource(source)
46 changes: 46 additions & 0 deletions website/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { source } from '@/lib/source'
import {
DocsPage,
DocsBody,
DocsTitle,
DocsDescription,
} from 'fumadocs-ui/page'
import { notFound } from 'next/navigation'
import defaultMdxComponents from 'fumadocs-ui/mdx'

export default async function Page(props: {
params: Promise<{ slug?: string[] }>
}) {
const params = await props.params
const page = source.getPage(params.slug)
if (!page) notFound()

const MDX = page.data.body

return (
<DocsPage toc={page.data.toc} full={page.data.full}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsBody>
<MDX components={{ ...defaultMdxComponents }} />
</DocsBody>
</DocsPage>
)
}

export async function generateStaticParams() {
return source.generateParams()
}

export async function generateMetadata(props: {
params: Promise<{ slug?: string[] }>
}) {
const params = await props.params
const page = source.getPage(params.slug)
if (!page) notFound()

return {
title: page.data.title,
description: page.data.description,
}
}
40 changes: 40 additions & 0 deletions website/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
import type { ReactNode } from 'react'
import { source } from '@/lib/source'

function Logo() {
return (
<>
<style>{`
.logo-light, .logo-dark { height: 28px; }
.logo-dark { display: none !important; }
.dark .logo-light { display: none !important; }
.dark .logo-dark { display: block !important; }
`}</style>
<img
src="/images/dbdev-lightmode.png"
alt="dbdev logo"
className="logo-light"
/>
<img
src="/images/dbdev-darkmode.png"
alt="dbdev logo"
className="logo-dark"
/>
</>
)
}

export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout
tree={source.pageTree}
nav={{
title: <Logo />,
url: '/',
}}
>
{children}
</DocsLayout>
)
}
13 changes: 13 additions & 0 deletions website/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { RootProvider } from 'fumadocs-ui/provider'
import type { ReactNode } from 'react'
import 'fumadocs-ui/style.css'

export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<RootProvider>{children}</RootProvider>
</body>
</html>
)
}
4 changes: 1 addition & 3 deletions website/components/layouts/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ const Navbar = () => {
<div className="flex items-center justify-end gap-2 sm:gap-6 sm:min-w-[160px]">
<div className="flex items-center ml-1 sm:ml-4">
<Button variant="link" asChild>
<Link href="https://supabase.github.io/dbdev/" target="blank">
Docs
</Link>
<Link href="/docs">Docs</Link>
</Button>

{user ? (
Expand Down
41 changes: 25 additions & 16 deletions docs/cli.md → website/content/docs/cli.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
---
title: Using the CLI
description: Install, upgrade, and use the dbdev CLI
---

import { Tab, Tabs } from 'fumadocs-ui/components/tabs'

The `dbdev` CLI can be used for:

- Installing TLEs from [database.dev](https://database.dev/) or your local machine.
Expand All @@ -11,15 +18,14 @@ Installation is available through a native package, binary download or building

### Native Package

=== "macOS"

<Tabs items={['macOS', 'Linux', 'Windows']}>
<Tab value="macOS">
Install the CLI with [Homebrew](https://brew.sh/):
```
brew install supabase/tap/dbdev
```

=== "Linux"

</Tab>
<Tab value="Linux">
Install the CLI with [Homebrew](https://brew.sh/):
```
brew install supabase/tap/dbdev
Expand All @@ -34,30 +40,31 @@ Installation is available through a native package, binary download or building
sudo dpkg -i <...>.deb
```

=== "Windows"

</Tab>
<Tab value="Windows">
Install the CLI with [Scoop](https://scoop.sh/).
```
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install dbdev
```
</Tab>
</Tabs>

## Upgrading

Use `dbdev --version` to check if you are on the latest version of the CLI.

### Native Package

=== "macOS"

<Tabs items={['macOS', 'Linux', 'Windows']}>
<Tab value="macOS">
Upgrade the CLI with [Homebrew](https://brew.sh/):
```
brew upgrade dbdev
```

=== "Linux"

Install the CLI with [Homebrew](https://brew.sh/):
</Tab>
<Tab value="Linux">
Upgrade the CLI with [Homebrew](https://brew.sh/):
```
brew upgrade dbdev
```
Expand All @@ -71,12 +78,14 @@ Use `dbdev --version` to check if you are on the latest version of the CLI.
sudo dpkg -i <...>.deb
```

=== "Windows"

</Tab>
<Tab value="Windows">
Update the CLI with [Scoop](https://scoop.sh/).
```
scoop update dbdev
```
</Tab>
</Tabs>

### Binary Download

Expand All @@ -93,4 +102,4 @@ Alternatively, you can build the binary from source. You will need to have [Rust

If you have [cargo-install](https://doc.rust-lang.org/cargo/commands/cargo-install.html), you can perform all the above steps with a single command: `cargo install --git https://github.com/supabase/dbdev.git dbdev`.

Now you're ready to [publish your first package](publish-extension.md).
Now you're ready to [publish your first package](/docs/publish-extension).
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Structure of a Postgres Extension
description: Learn about the files that make up a Postgres trusted language extension
---

A Postgres [trusted language extension](https://github.com/aws/pg_tle) (TLE) consists of the following files:

1. Script files. These files contain the SQL commands to create the extension's objects.
Expand All @@ -6,9 +11,9 @@ A Postgres [trusted language extension](https://github.com/aws/pg_tle) (TLE) con
For an extension to be valid, one file of each type must be present in an extension. For example, if you want to create an extension named `my-extension`, create the following folder structure:

- my-extension
- my-extension.control
- my-extension--0.0.1.sql
- README.md
- my-extension.control
- my-extension--0.0.1.sql
- README.md

In the above example, the `my-extension` folder contains the extension files. Names of the files are important. The control file should be named `<extension_name>.control` and the script file should be named `<extension_name>--<extension_version>.sql`. The readme file should be named `README.md` (case sensitive).

Expand All @@ -24,7 +29,7 @@ A control file contains metadata about the extension in key-value pairs. The mos

For example, the [pgjwt extension's control file](https://github.com/michelp/pgjwt/blob/master/pgjwt.control) looks like this:

```control
```
# pgjwt extension
comment = 'JSON Web Token API for Postgresql'
default_version = '0.2.0'
Expand Down Expand Up @@ -67,7 +72,6 @@ comment = ACommentForTheExtension
comment = 'A double quote '' and a newline \n'
```


## Script Files

Script files contain the SQL commands to create or modify database objects. These database objects can be, but are not limited to, tables, views, functions, types, operators etc. For example, the [pgjwt's `pgjwt--0.1.1.sql` file](https://github.com/michelp/pgjwt/blob/master/pgjwt--0.1.1.sql) contains definitions for functions which the extension adds to the database. One exception to the SQL commands which can exist in a script file are transaction control commands like `BEGIN`, `COMMIT`, `ROLLBACK` etc.
Expand Down
Loading