generate
migrate
push
pull
check
up
studio
npm i drizzle-orm @aws-sdk/client-rds-data npm i -D drizzle-kit
yarn add drizzle-orm @aws-sdk/client-rds-data yarn add -D drizzle-kit
pnpm add drizzle-orm @aws-sdk/client-rds-data pnpm add -D drizzle-kit
bun add drizzle-orm @aws-sdk/client-rds-data bun add -D drizzle-kit
import { drizzle } from 'drizzle-orm/aws-data-api-pg'; // 这三个属性是必需的。您也可以在连接对象中指定 // RDSDataClient 类型的任何属性。 const db = drizzle({ connection: { database: process.env['DATABASE']!, secretArn: process.env['SECRET_ARN']!, resourceArn: process.env['RESOURCE_ARN']!, }}); await db.select().from(...);
如果您需要提供您现有的驱动程序:
import { drizzle } from 'drizzle-orm/aws-data-api/pg'; import { RDSDataClient } from '@aws-sdk/client-rds-data'; const rdsClient = new RDSDataClient({ region: 'us-east-1' }); const db = drizzle(rdsClient, { database: process.env['DATABASE']!, secretArn: process.env['SECRET_ARN']!, resourceArn: process.env['RESOURCE_ARN']!, }); await db.select().from(...);
Manage schema
Query data