mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 06:39:09 +03:00
<img width="2892" height="2342" alt="image" src="https://github.com/user-attachments/assets/7e08929d-abc3-4397-b89d-99cc52d8190e" /> This is the third and final PR to complete the new connect sheet. First: https://github.com/supabase/supabase/pull/42367 Second: https://github.com/supabase/supabase/pull/42373 This re-adds the Direct, ORM, MCP tabs and their content, including via connect.schema. To test: - Flag will be enabled on all staging projects - Click connect and notice new Sheet - Click all tabs and ensure content is correct <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Multi-mode connection flow with mode selector and icons (framework, direct DB, ORM, MCP) * New framework/variant/library selector, richer connection guides and install steps (Prisma, Drizzle, direct) * MCP onboarding flows (Cursor, Codex, Claude Code) with server/auth commands and configuration UIs * **Refactor** * Connect schema and state rebuilt to be mode-driven with improved step resolution and cascading state updates * **Tests** * Expanded unit tests covering framework resolution, connect flows, and mode behaviors * **Chores** * ESLint ignores updated for content files <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
|
|
|
|
import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
|
|
|
|
const ContentFile = ({ connectionStringPooler }: StepContentProps) => {
|
|
const files = [
|
|
{
|
|
name: '.env',
|
|
language: 'bash',
|
|
code:
|
|
connectionStringPooler.ipv4SupportedForDedicatedPooler &&
|
|
connectionStringPooler.transactionDedicated
|
|
? `
|
|
DATABASE_URL="${connectionStringPooler.transactionDedicated}"
|
|
`
|
|
: connectionStringPooler.transactionDedicated &&
|
|
!connectionStringPooler.ipv4SupportedForDedicatedPooler
|
|
? `
|
|
# Use Shared connection pooler (supports both IPv4/IPv6)
|
|
DATABASE_URL="${connectionStringPooler.transactionShared}"
|
|
|
|
# If your network supports IPv6 or you purchased IPv4 addon, use dedicated pooler
|
|
# DATABASE_URL="${connectionStringPooler.transactionDedicated}"
|
|
`
|
|
: `
|
|
DATABASE_URL="${connectionStringPooler.transactionShared}"
|
|
`,
|
|
},
|
|
{
|
|
name: 'drizzle/schema.ts',
|
|
language: 'tsx',
|
|
code: `
|
|
import { pgTable, serial, text, varchar } from "drizzle-orm/pg-core";
|
|
|
|
export const users = pgTable('users', {
|
|
id: serial('id').primaryKey(),
|
|
fullName: text('full_name'),
|
|
phone: varchar('phone', { length: 256 }),
|
|
});
|
|
`,
|
|
},
|
|
{
|
|
name: 'index.tsx',
|
|
language: 'tsx',
|
|
code: `
|
|
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
import postgres from 'postgres'
|
|
import { users } from './drizzle/schema'
|
|
|
|
const connectionString = process.env.DATABASE_URL
|
|
|
|
// Disable prefetch as it is not supported for "Transaction" pool mode
|
|
const client = postgres(connectionString, { prepare: false })
|
|
const db = drizzle(client);
|
|
|
|
const allUsers = await db.select().from(users);
|
|
`,
|
|
},
|
|
]
|
|
|
|
return <MultipleCodeBlock files={files} />
|
|
}
|
|
|
|
export default ContentFile
|