-
Notifications
You must be signed in to change notification settings - Fork 198
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Self Checks
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
Version Type
CLI Version (npm package)
Version (only for Self Hosted)
No response
Steps to reproduce
- Create a Drizzle ORM schema that uses
foreignKeyinstead of.references()
import { primaryKey, serial, foreignKey, pgTable, text } from "drizzle-orm/pg-core";
export const user = pgTable("user", {
firstName: text("firstName"),
lastName: text("lastName"),
}, (table) => [
primaryKey({ columns: [table.firstName, table.lastName]})
]);
export const profile = pgTable("profile", {
id: serial("id").primaryKey(),
userFirstName: text("user_first_name"),
userLastName: text("user_last_name"),
}, (table) => [
foreignKey({
columns: [table.userFirstName, table.userLastName],
foreignColumns: [user.firstName, user.lastName],
name: "custom_fk"
})
]);- Run
npx @liam-hq/cli erd build --format drizzle --input ./db/sample-schema.ts - Observe lack of crows feet denoting relations, and missing relationship properties

It also seems to miss the composite primary key in the user table.
Expected Behavior
- Detect usage of operators such as
foreignKey,primaryKey - Apply logic as it otherwise would for
.references()
Actual Behavior
No acknowledgement of foreignKey or primaryKey operators
Additional Context
https://orm.drizzle.team/docs/indexes-constraints#foreign-key
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working