Skip to content

Commit

Permalink
feat(docs): update drizzle recipe to add creating schema step
Browse files Browse the repository at this point in the history
  • Loading branch information
tszhong0411 committed Feb 6, 2025
1 parent 5655c8b commit 693d1db
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion apps/docs/src/content/recipes/drizzle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,24 @@ services:
docker compose up -d
```

## 5. Apply Migrations
## 5. Add your schema (Example)

```ts title='src/db/schema/users.ts'
import { integer, pgTable, varchar } from 'drizzle-orm/pg-core'
export const usersTable = pgTable('users', {
id: integer().primaryKey().generatedAlwaysAsIdentity(),
name: varchar({ length: 255 }).notNull(),
age: integer().notNull(),
email: varchar({ length: 255 }).notNull().unique()
})
```

```ts title='src/db/schema/index.ts'
export * from './users'
```

## 6. Apply Migrations

```bash
pnpm db:generate
Expand Down

0 comments on commit 693d1db

Please sign in to comment.