Skip to content

Commit

Permalink
fix: drizzle studio not showing entities
Browse files Browse the repository at this point in the history
  • Loading branch information
yamcodes committed Oct 9, 2023
1 parent 7eec6aa commit b4becf5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion db/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const dbCredentialsString = `postgres://${dbCredentials.user}:${dbCredent

export default {
out: './db/migrations',
schema: '**/*.schema.ts',
// in our codebase, 'schema' refers to TypeBox objects (abstraction of a JSON schema), while 'model' refers to database entities/tables, which is what drizzle refers to as 'schema'
schema: '**/*.model.ts',
breakpoints: false,
driver: 'pg',
dbCredentials,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs",
"up": "./scripts/create-start-container-with-env.sh",
"db:generate": "bun drizzle-kit generate:pg --config=db/config.ts",
"db:generate": "drizzle-kit generate:pg --config=db/config.ts",
"db:migrate": "bun run db/migrate.ts",
"db:push": "bun drizzle-kit push:pg --config=db/config.ts",
"db:push": "drizzle-kit push:pg --config=db/config.ts",
"db:seed": "bun db/seed.ts",
"db:studio": "bun drizzle-kit studio --config=db/config.ts",
"db:studio": "drizzle-kit studio --config=db/config.ts",
"db:drop": "bun db/drop.ts",
"prepare": "husky install"
},
Expand Down
3 changes: 2 additions & 1 deletion src/users/users.schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Type } from '@sinclair/typebox';
import { createInsertSchema, createSelectSchema } from 'drizzle-typebox';
import { users } from '@users/users.model';
// Do not use path aliases here (i.e. '@/users/users.model'), as that doesn't work with Drizzle Studio
import { users } from './users.model';

// Schema for inserting a user - can be used to validate API requests
const insertUserSchemaRaw = createInsertSchema(users);
Expand Down

0 comments on commit b4becf5

Please sign in to comment.