Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update 2023-08-08-supabase-local-dev.mdx

Jonathan Summers-Muir04c24089b732
diff --git a/apps/www/_blog/2023-08-08-supabase-local-dev.mdx b/apps/www/_blog/2023-08-08-supabase-local-dev.mdx
index 3688210b931..5d22bc0ce4d 100644
--- a/apps/www/_blog/2023-08-08-supabase-local-dev.mdx
+++ b/apps/www/_blog/2023-08-08-supabase-local-dev.mdx
@@ -39,15 +39,16 @@ A lot of the credit for this belongs to [Heroku’s pg-extras](https://github.co
This is just a starting point for the Supabase inspector. We’ll grow this feature to become an essential part of your Postgres toolkit.
<details>
- <summary>See full command</summary>
-
+<summary>See full command</summary>
+ <div>
+ {/* prettier-ignore */}
```markdown
supabase inspect db --help
Tools to inspect your Supabase database
-
+
Usage:
supabase inspect db [command]
-
+
Available Commands:
bloat Estimates space allocated to a relation that is full of dead tuples
blocking Show queries that are holding locks and the queries that are waiting for them to be released
@@ -69,29 +70,34 @@ This is just a starting point for the Supabase inspector. We’ll grow this feat
unused-indexes Show indexes with low usage
vacuum-stats Show statistics related to vacuum operations per table
```
+
+ </div>
</details>
<details>
-<summary>- Read the docs</summary>
- - [Show most frequently run queries](https://supabase.com/docs/reference/cli/supabase-inspect-db-calls)
- - [Show long running queries](https://supabase.com/docs/reference/cli/supabase-inspect-db-long-running-queries)
- - [Show queries ordered by total execution time](https://supabase.com/docs/reference/cli/supabase-inspect-db-outliers)
- - [Show queries waiting and holding locks](https://supabase.com/docs/reference/cli/supabase-inspect-db-blocking)
- - [Show queries taking exclusive locks](https://supabase.com/docs/reference/cli/supabase-inspect-db-locks)
- - [Show total size of all indexes](https://supabase.com/docs/reference/cli/supabase-inspect-db-total-index-size)
- - [Show sizes of individual indexes](https://supabase.com/docs/reference/cli/supabase-inspect-db-index-sizes)
- - [Show information about index efficiency](https://supabase.com/docs/reference/cli/supabase-inspect-db-index-usage)
- - [Show indexes with low usage](https://supabase.com/docs/reference/cli/supabase-inspect-db-unused-indexes)
- - [Show total size of all tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-total-table-sizes)
- - [Show sizes of individual tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-table-sizes)
- - [Show index sizes of individual tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-table-index-sizes)
- - [Show cache hit rates for tables and indices](https://supabase.com/docs/reference/cli/supabase-inspect-db-cache-hit)
- - [Show estimated number of rows per table](https://supabase.com/docs/reference/cli/supabase-inspect-db-table-record-counts)
- - [Show number of sequential scans for all tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-seq-scans)
- - [Show information about replication slots](https://supabase.com/docs/reference/cli/supabase-inspect-db-replication-slots)
- - [Show number of active connections](https://supabase.com/docs/reference/cli/supabase-inspect-db-role-connections)
- - [Show estimated database bloat](https://supabase.com/docs/reference/cli/supabase-inspect-db-bloat)
- - [Show statistics related to vacuum operations](https://supabase.com/docs/reference/cli/supabase-inspect-db-vacuum-stats)
+<summary>Read the docs</summary>
+<div>
+
+- [Show most frequently run queries](https://supabase.com/docs/reference/cli/supabase-inspect-db-calls)
+- [Show long running queries](https://supabase.com/docs/reference/cli/supabase-inspect-db-long-running-queries)
+- [Show queries ordered by total execution time](https://supabase.com/docs/reference/cli/supabase-inspect-db-outliers)
+- [Show queries waiting and holding locks](https://supabase.com/docs/reference/cli/supabase-inspect-db-blocking) - [Show queries taking exclusive locks](https://supabase.com/docs/reference/cli/supabase-inspect-db-locks)
+- [Show total size of all indexes](https://supabase.com/docs/reference/cli/supabase-inspect-db-total-index-size)
+- [Show sizes of individual indexes](https://supabase.com/docs/reference/cli/supabase-inspect-db-index-sizes)
+- [Show information about index efficiency](https://supabase.com/docs/reference/cli/supabase-inspect-db-index-usage)
+- [Show indexes with low usage](https://supabase.com/docs/reference/cli/supabase-inspect-db-unused-indexes)
+- [Show total size of all tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-total-table-sizes)
+- [Show sizes of individual tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-table-sizes)
+- [Show index sizes of individual tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-table-index-sizes)
+- [Show cache hit rates for tables and indices](https://supabase.com/docs/reference/cli/supabase-inspect-db-cache-hit)
+- [Show estimated number of rows per table](https://supabase.com/docs/reference/cli/supabase-inspect-db-table-record-counts)
+- [Show number of sequential scans for all tables](https://supabase.com/docs/reference/cli/supabase-inspect-db-seq-scans)
+- [Show information about replication slots](https://supabase.com/docs/reference/cli/supabase-inspect-db-replication-slots)
+- [Show number of active connections](https://supabase.com/docs/reference/cli/supabase-inspect-db-role-connections)
+- [Show estimated database bloat](https://supabase.com/docs/reference/cli/supabase-inspect-db-bloat) -
+- [Show statistics related to vacuum operations](https://supabase.com/docs/reference/cli/supabase-inspect-db-vacuum-stats)
+
+</div>
</details>
## Easier backups
@@ -101,22 +107,26 @@ This is just a starting point for the Supabase inspector. We’ll grow this feat
We’ve made it even easer to backup and migrate your database, using `supabase db dump`. Under the hood, this simply uses [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html) (it's just Postgres, after all). However we also handle a few of the hairy issues that you might need to navigate on your own, like object permissions.
<details>
-<summary>- See full command</summary>
-
- ```markdown
+ <summary>See full command</summary>
+ <div>
+
+ {/* prettier-ignore */}
+ ```markdown
supabase db dump --help
Dumps data or schemas from the remote database
-
+
Usage:
- supabase db dump [flags]
-
+ supabase db dump [flags]
+
Flags:
- --data-only Dumps only data records.
- -f, --file string File path to save the dumped contents.
- --keep-comments Keeps commented lines from pg_dump output.
- --role-only Dumps only cluster roles.
- --use-copy Uses copy statements in place of inserts.
+ --data-only Dumps only data records.
+ -f, --file string File path to save the dumped contents.
+ --keep-comments Keeps commented lines from pg_dump output.
+ --role-only Dumps only cluster roles.
+ --use-copy Uses copy statements in place of inserts.
```
+
+ </div>
</details>
## Improved Database Migrations
@@ -130,15 +140,16 @@ With the new Postgres Language Server, we hope to make it as easy to write Postg
Finally, we’ve added a Migrations view [in the dashboard](https://app.supabase.com/project/_/database/migrations) to track your migration history to improve the discoverability of migrations.
<details>
-<summary>- See full command</summary>
-
+ <summary>See full command</summary>
+ <div>
+ {/* prettier-ignore */}
```markdown
supabase migration
Manage database migration scripts
-
+
Usage:
supabase migration [command]
-
+
Available Commands:
list List local and remote migrations
new Create an empty migration script
@@ -146,6 +157,8 @@ Finally, we’ve added a Migrations view [in the dashboard](https://app.supabase
squash Squash migrations to a single file
up Apply pending migrations to local database
```
+
+ </div>
</details>
## Test and lint your database
@@ -159,33 +172,37 @@ To make life even easier, our friends at [Basejump](https://usebasejump.com/) ha
Finally, while you wait for us to make progress on the Language Server, we’ve added [support for linting](https://supabase.com/docs/guides/cli/testing-and-linting#linting-your-database) through the excellent [plpgsql_check](https://github.com/okbob/plpgsql_check) extension.
<details>
-<summary>- See full command</summary>
-
+ <summary>See full command</summary>
+ <div>
+
+ {/* prettier-ignore */}
```markdown
supabase test
Run tests on local Supabase containers
-
+
Usage:
supabase test [command]
-
+
Available Commands:
db Tests local database with pgTAP
new Create a new test file
- ```
-
+ ````
+ {/* prettier-ignore */}
```markdown
supabase db lint
Checks local database for typing error
-
+
Usage:
supabase db lint [flags]
-
+
Flags:
-h, --help help for lint
--level [ warning | error ] Error level to emit. (default warning)
--linked Lints the linked project for schema errors.
-s, --schema strings List of schema to include. (default all)
```
+
+ </div>
</details>
## Database seeding
@@ -219,18 +236,22 @@ let movie: Tables<'movies'> = // ...
```
<details>
-<summary>- See full command</summary>
-
+ <summary>See full command</summary>
+ <div>
+
+ {/* prettier-ignore */}
```markdown
supabase gen types
Generate types from Postgres schema
-
+
Usage:
supabase gen types [command]
-
+
Available Commands:
typescript Generate types for TypeScript
```
+
+ </div>
</details>
## Official GitHub Action