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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ POSTGRES_URL=****
# Instructions to create a Redis store here:
# https://vercel.com/docs/redis
REDIS_URL=****

# Get your DeepSeek API Key here for chat and image models
DEEPSEEK_API_KEY=****

# Supabase PostgreSQL database
SUPABASE_POSTGRES_URL=****
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
SUPABASE_POSTGRES_URL: ${{ secrets.SUPABASE_POSTGRES_URL }}
BLOB_READ_WRITE_TOKEN: ${{ secrets.BLOB_READ_WRITE_TOKEN }}
REDIS_URL: ${{ secrets.REDIS_URL }}

Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"source.fixAll": "explicit"
// "source.organizeImports": "explicit"
},
"cSpell.words": ["deepseek"]
"cSpell.words": ["deepseek", "SUPABASE"]
}
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export default defineConfig({
dialect: 'postgresql',
dbCredentials: {
// biome-ignore lint: Forbidden non-null assertion.
url: process.env.POSTGRES_URL!,
url: process.env.SUPABASE_POSTGRES_URL!,
},
});
6 changes: 3 additions & 3 deletions lib/db/helpers/01-core-to-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ config({
path: '.env.local',
});

if (!process.env.POSTGRES_URL) {
throw new Error('POSTGRES_URL environment variable is not set');
if (!process.env.SUPABASE_POSTGRES_URL) {
throw new Error('SUPABASE_POSTGRES_URL environment variable is not set');
}

const client = postgres(process.env.POSTGRES_URL);
const client = postgres(process.env.SUPABASE_POSTGRES_URL);
const db = drizzle(client);

const BATCH_SIZE = 100; // Process 100 chats at a time
Expand Down
6 changes: 3 additions & 3 deletions lib/db/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ config({
});

const runMigrate = async () => {
if (!process.env.POSTGRES_URL) {
throw new Error('POSTGRES_URL is not defined');
if (!process.env.SUPABASE_POSTGRES_URL) {
throw new Error('SUPABASE_POSTGRES_URL is not defined');
}

const connection = postgres(process.env.POSTGRES_URL, { max: 1 });
const connection = postgres(process.env.SUPABASE_POSTGRES_URL, { max: 1 });
const db = drizzle(connection);

console.log('⏳ Running migrations...');
Expand Down
5 changes: 4 additions & 1 deletion lib/db/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ import { ChatSDKError } from '../errors';
// use the Drizzle adapter for Auth.js / NextAuth
// https://authjs.dev/reference/adapter/drizzle

// const client = postgres(process.env.POSTGRES_URL!);

// 使用 Supabase 的 PostgreSQL
// biome-ignore lint: Forbidden non-null assertion.
const client = postgres(process.env.POSTGRES_URL!);
const client = postgres(process.env.SUPABASE_POSTGRES_URL!, { prepare: false });
const db = drizzle(client);

export async function getUser(email: string): Promise<Array<User>> {
Expand Down