mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 01:15:03 +03:00
docs: fix broken code examples and wrong identifiers in guides (#46755)
A handful of code samples in the guides either don't run or contradict
the surrounding text. I found these reading through the docs.
- `database/debugging-performance`: `insert into books` targets a table
that's never created. The table made just above is `instruments`.
- `database/drizzle`: the `db.ts` snippet references an undefined
`host`. The variable in scope is `connectionString`.
- `database/postgres/column-level-security`: the `create table` is
missing a comma after `created_at ... now()`, so it won't parse.
- `database/postgres/first-row-in-group`: `distinct on (team)` with
`order by id, ...` is rejected by Postgres (the DISTINCT ON column has
to lead the ORDER BY). Ordered by `team, points desc` so it returns one
row per team.
- `database/postgres/data-deletion`: reversed markdown link
`(text)[url]`, plus "parititioning" misspelled.
- `database/extensions/pg_plan_filter`: prose says
`statement_cost_filter`, but the real parameter (used everywhere else in
the file) is `statement_cost_limit`.
- `auth/auth-hooks/mfa-verification-hook`: the insert and on-conflict
update use `last_refreshed_at`, but the table column is
`last_failed_at`.
- `telemetry/advanced-log-filtering`: the "ends with" example writes
`'$port=12345'`. The `$` anchor needs to come after the literal:
`'port=12345$'`.
- `ai/examples/headless-vector-search`: uses `${projectURL}` but the
const is `projectUrl`.
- `getting-started/quickstarts/redwoodjs`: prose says
`scripts/seeds.ts`, but the code block and Redwood use
`scripts/seed.ts`.
- `getting-started/tutorials/with-flutter`: two code-fence headers have
a stray trailing `"`.
- `local-development/cli/testing-and-linting`: stray backtick in "Edge`
Functions".
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Corrected code examples across multiple guides including vector
search, authentication hooks, database guides, and quickstarts
* Fixed SQL syntax errors, variable names, and table references in
example snippets
* Resolved typos, broken links, and formatting inconsistencies in guide
text
* Clarified parameter names and script references in documentation
* Updated code fence syntax in tutorials for proper rendering
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
This commit is contained in:
1 parent
5662a72ef5
commit
64085b2d0c
12 files changed
+17
-18
No files matched your search
@@ -84,7 +84,7 @@ const onSubmit = (e: Event) => {
|
||||
|
||||
const query = new URLSearchParams({ query: inputRef.current!.value })
|
||||
const projectUrl = `https://your-project-ref.supabase.co/functions/v1`
|
||||
const queryURL = `${projectURL}/${query}`
|
||||
const queryURL = `${projectUrl}/${query}`
|
||||
const eventSource = new EventSource(queryURL)
|
||||
|
||||
eventSource.addEventListener("error", (err) => {
|
||||
|
||||
@@ -142,7 +142,7 @@ as $$
|
||||
(
|
||||
user_id,
|
||||
factor_id,
|
||||
last_refreshed_at
|
||||
last_failed_at
|
||||
)
|
||||
values
|
||||
(
|
||||
@@ -151,7 +151,7 @@ as $$
|
||||
now()
|
||||
)
|
||||
on conflict do update
|
||||
set last_refreshed_at = now();
|
||||
set last_failed_at = now();
|
||||
|
||||
-- finally let Supabase Auth do the default behavior for a failed attempt
|
||||
return jsonb_build_object('decision', 'continue');
|
||||
|
||||
@@ -44,7 +44,7 @@ create table instruments (
|
||||
name text
|
||||
);
|
||||
|
||||
insert into books
|
||||
insert into instruments
|
||||
(id, name)
|
||||
values
|
||||
(1, 'violin'),
|
||||
|
||||
@@ -81,8 +81,8 @@ If you plan on solely using Drizzle instead of the Supabase Data API (PostgREST)
|
||||
import postgres from 'postgres'
|
||||
|
||||
let connectionString = process.env.DATABASE_URL
|
||||
if (host.includes('postgres:postgres@supabase_db_')) {
|
||||
const url = URL.parse(host)!
|
||||
if (connectionString.includes('postgres:postgres@supabase_db_')) {
|
||||
const url = URL.parse(connectionString)!
|
||||
url.hostname = url.hostname.split('_')[1]
|
||||
connectionString = url.href
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ explain select * from book;
|
||||
(1 row)
|
||||
```
|
||||
|
||||
Now we can choose a `statement_cost_filter` value between the total cost for the single select (2.49) and the whole table select (135.0) so one statement will succeed and one will fail.
|
||||
Now we can choose a `statement_cost_limit` value between the total cost for the single select (2.49) and the whole table select (135.0) so one statement will succeed and one will fail.
|
||||
|
||||
{/* prettier-ignore */}
|
||||
```sql
|
||||
|
||||
@@ -134,7 +134,7 @@ supabase migration new create_posts_table
|
||||
user_id text,
|
||||
title text,
|
||||
content text,
|
||||
created_at timestamptz default now()
|
||||
created_at timestamptz default now(),
|
||||
updated_at timestamptz default now()
|
||||
);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ WHERE id IN (
|
||||
|
||||
This approach has the benefit of controlling when it runs, locking for a shorter period of time and minimising impact on other transactions.
|
||||
|
||||
If you know in advance that such large deletes will have to happen in the business cycle of your database, then you should seriously think about using (table parititioning)[/docs/guides/database/partitions] as a management tool.
|
||||
If you know in advance that such large deletes will have to happen in the business cycle of your database, then you should seriously think about using [table partitioning](/docs/guides/database/partitions) as a management tool.
|
||||
|
||||
### Soft deletes
|
||||
|
||||
|
||||
@@ -32,10 +32,9 @@ select distinct
|
||||
points
|
||||
from
|
||||
seasons
|
||||
order BY
|
||||
id,
|
||||
points desc,
|
||||
team;
|
||||
order by
|
||||
team,
|
||||
points desc;
|
||||
```
|
||||
|
||||
The important bits here are:
|
||||
|
||||
@@ -145,7 +145,7 @@ hideToc: true
|
||||
<StepHikeCompact.Details title="Update seed script">
|
||||
Let's seed the database with a few instruments.
|
||||
|
||||
Update the file `scripts/seeds.ts` to contain the following code:
|
||||
Update the file `scripts/seed.ts` to contain the following code:
|
||||
</StepHikeCompact.Details>
|
||||
|
||||
<StepHikeCompact.Code>
|
||||
|
||||
@@ -67,7 +67,7 @@ Add `CFBundleURLTypes` to enable deep linking:
|
||||
|
||||
<$CodeTabs>
|
||||
|
||||
```xml name=ios/Runner/Info.plist"
|
||||
```xml name=ios/Runner/Info.plist
|
||||
<!-- ... other tags -->
|
||||
<plist>
|
||||
<dict>
|
||||
@@ -314,7 +314,7 @@ Let's create a new widget called `account_page.dart` for that.
|
||||
|
||||
<$CodeTabs>
|
||||
|
||||
```dart name=lib/pages/account_page.dart"
|
||||
```dart name=lib/pages/account_page.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'package:supabase_quickstart/main.dart';
|
||||
|
||||
@@ -5,7 +5,7 @@ description: 'Using the CLI to test your Supabase project.'
|
||||
subtitle: 'Using the CLI to test your Supabase project.'
|
||||
---
|
||||
|
||||
The Supabase CLI provides a set of tools to help you test and lint your Postgres database and Edge` Functions.
|
||||
The Supabase CLI provides a set of tools to help you test and lint your Postgres database and Edge Functions.
|
||||
|
||||
## Testing your database
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ regexp_contains(event_message, '^connection')
|
||||
|
||||
```sql
|
||||
-- find only messages that ends with port=12345
|
||||
regexp_contains(event_message, '$port=12345')
|
||||
regexp_contains(event_message, 'port=12345$')
|
||||
```
|
||||
|
||||
### Ignore case sensitivity:
|
||||
|
||||
Reference in new issue
Block a user