Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title = "Why is my camelCase name not working in Postgres functions or RLS policies?"
github_url = "https://github.com/orgs/supabase/discussions/12893"
date_created = "2023-03-08T16:26:51+00:00"
topics = ["database"]
---

Avoid camelCase (upper case letters) if possible when naming functions, tables, columns, and variables. You must enclose "camelCase" in double quotes when you define it or use it. YOU WILL FORGET. Use snake_case instead and make your life easier.

Note to Prisma users, you will likely have to deal with it.
11 changes: 11 additions & 0 deletions apps/docs/features/directives/CodeSample.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ import Link from 'next/link'
import { useState, type PropsWithChildren } from 'react'

import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from 'ui'
import { Admonition } from 'ui-patterns/admonition'

export function CodeSampleDummy() {
return (
<Admonition type="caution" title="Local development warning">
The <code>$CodeSample</code> directive with external repos is not supported in local
development because it relies on a GitHub API key. Please check the preview site to see the
final UI.
</Admonition>
)
}

export function CodeSampleWrapper({
children,
Expand Down
9 changes: 8 additions & 1 deletion apps/docs/features/directives/CodeSample.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ const transformWithMock = codeSampleRemark({

let env: NodeJS.Process['env']

vi.mock('~/lib/constants', () => ({
IS_PLATFORM: true,
}))

describe('$CodeSample', () => {
beforeAll(() => {
env = process.env
process.env = { NODE_ENV: 'test', NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA: '1234567890' }
process.env = {
NODE_ENV: 'test',
NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA: '1234567890',
}
})

afterAll(() => {
Expand Down
7 changes: 7 additions & 0 deletions apps/docs/features/directives/CodeSample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { visitParents } from 'unist-util-visit-parents'
import { z, type SafeParseError } from 'zod'

import { fetchWithNextOptions } from '~/features/helpers.fetch'
import { IS_PLATFORM } from '~/lib/constants'
import { EXAMPLES_DIRECTORY } from '~/lib/docs'

const ALLOW_LISTED_GITHUB_ORGS = ['supabase', 'supabase-community'] as [string, ...string[]]
Expand Down Expand Up @@ -141,6 +142,12 @@ async function fetchSourceCodeContent(tree: Root, deps: Dependencies) {
const isExternal = getAttributeValueExpression(getAttributeValue(node, 'external')) === 'true'

if (isExternal) {
if (!IS_PLATFORM) {
node.name = 'CodeSampleDummy'
node.attributes = []
return
}

const org = getAttributeValue(node, 'org')
const repo = getAttributeValue(node, 'repo')
const commit = getAttributeValue(node, 'commit')
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/features/docs/MdxBase.shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { RealtimeLimitsEstimator } from '~/components/RealtimeLimitsEstimator'
import { RegionsList } from '~/components/RegionsList'
import { SharedData } from '~/components/SharedData'
import StepHikeCompact from '~/components/StepHikeCompact'
import { CodeSampleWrapper } from '~/features/directives/CodeSample.client'
import { CodeSampleDummy, CodeSampleWrapper } from '~/features/directives/CodeSample.client'
import { Accordion, AccordionItem } from '~/features/ui/Accordion'
import * as CH from '~/features/ui/CodeHike'
import { ShowUntil } from '~/features/ui/ShowUntil'
Expand All @@ -53,6 +53,7 @@ const components = {
Button,
ButtonCard,
CH,
CodeSampleDummy,
CodeSampleWrapper,
CostWarning,
CreateClientSnippet,
Expand Down
17 changes: 10 additions & 7 deletions apps/docs/features/docs/Troubleshooting.ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function TroubleshootingPreview({ entry }: { entry: ITroubleshootin
{...attributes}
>
<div className="flex flex-wrap items-start gap-x-2 gap-y-4 justify-between">
<div className="flex-grow flex flex-col gap-2">
<div className="max-w-[60%] flex flex-col gap-2">
<Link
href={`/guides/troubleshooting/${getArticleSlug(entry)}`}
className={cn('visited:text-foreground-lighter', 'before:absolute before:inset-0')}
Expand All @@ -48,12 +48,15 @@ export async function TroubleshootingPreview({ entry }: { entry: ITroubleshootin
</Link>
{entry.data.errors?.length > 0 && (
<span className="text-xs text-foreground-lighter">
{entry.data.errors.map((error, index) => (
<>
<code key={index}>{formatError(error)}</code>
{index < entry.data.errors.length - 1 && ', '}
</>
))}
{entry.data.errors
.map(formatError)
.filter(Boolean)
.map((error, index) => (
<>
<code key={index}>{error}</code>
{index < entry.data.errors.length - 1 ? ', ' : ''}
</>
))}
</span>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/features/docs/Troubleshooting.utils.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const TROUBLESHOOTING_DATA_ATTRIBUTES = {
}

export function formatError(error: ITroubleshootingEntry['data']['errors'][number]) {
return `${error.http_status_code ?? ''}${!!error.http_status_code && !!error.code && ' '}${error.code ?? ''}`
return `${error.http_status_code ?? ''}${!!error.http_status_code && !!error.code ? ' ' : ''}${error.code ?? ''}`
}

export const troubleshootingSearchParams = {
Expand Down
13 changes: 12 additions & 1 deletion apps/docs/internals/generate-sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function generate() {
const cliPages = generateCLIPages()
const referencePages = await generateReferencePages()

const contentFiles = await globby(['content/**/!(_)*.mdx'])
const contentFiles = await globby(['content/guides/**/!(_)*.mdx'])
const contentPages = await Promise.all(
contentFiles.map(async (filePath) => {
const fileContents = await fs.promises.readFile(filePath, 'utf8')
Expand All @@ -30,7 +30,18 @@ async function generate() {
})
)

const troubleshootingFiles = await globby(['content/troubleshooting/**/!(_)*.mdx'])
const troubleshootingPages = await Promise.all(
troubleshootingFiles.map(async (filePath) => {
return {
link: filePath.replace(/^content/, 'guides').replace(/\.mdx$/, ''),
priority: 1,
}
})
)

const allPages = (contentPages as Array<{ link: string; priority?: number }>).concat(
troubleshootingPages,
referencePages,
cliPages
)
Expand Down
12 changes: 9 additions & 3 deletions apps/www/_blog/2024-12-05-supabase-queues.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Once your Queue is configured you can begin adding Messages.
}}
/>

### Adding Messages from the Dashboard
### From the Dashboard

Let's create a new Basic Queue and add a Message.

Expand Down Expand Up @@ -133,7 +133,7 @@ Let's create a new Basic Queue and add a Message.
}}
/>

### Adding messages from the server
### From the server

If you're [connecting](/docs/guides/database/connecting-to-postgres) to your Postgres database from a server, you can add messages using SQL from any Postgres client:

Expand All @@ -144,7 +144,7 @@ select * from pgmq.send(
);
```

### Adding messages from the client
### From the client

We have provided several functions that can be invoked from the [client libraries](/docs#client-libraries) if you need to add messages from a browser or mobile app. For example:

Expand Down Expand Up @@ -214,6 +214,12 @@ From the Queues page, just click on a Queue to inspect it. From there you can cl
}}
/>

## Pricing

Supabase Queues runs entirely in your database so there's no additional costs to use the functionality.

We recommend you configure your database's Compute and Disk settings appropriately to support your Queues workload.

## Postgres for Everything

Using Postgres for your Queue system keeps your stack lean and familiar. You can add Messages to Queues within the same transaction that modifies related data, preventing inconsistencies and reducing the need for additional coordination. Postgres' robust indexing, JSONB support, and partitioning also enable scalable, high-performance queue management directly in your database.
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/nextjs/components/AuthButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default async function AuthButton() {
const signOut = async () => {
'use server'

const supabase = createClient()
const supabase = await createClient()
await supabase.auth.signOut()
return redirect('/login')
}
Expand Down
Loading