Cannot read properties of undefined (reading 'compositePrimaryKeys')

My table
export const tableName = pgTable(
'table_name',
{
t1Id: varchar('t1_id', { length: 255 })
.notNull()
.references(() => t1.id),
t2Id: varchar('t2_id', { length: 255 })
.notNull()
.references(() => t2.id),
...defaults,
},
(table) => {
return {
pk: primaryKey({
columns: [table.t1Id, table.t2Id],
}),
};
},
);
export const tableName = pgTable(
'table_name',
{
t1Id: varchar('t1_id', { length: 255 })
.notNull()
.references(() => t1.id),
t2Id: varchar('t2_id', { length: 255 })
.notNull()
.references(() => t2.id),
...defaults,
},
(table) => {
return {
pk: primaryKey({
columns: [table.t1Id, table.t2Id],
}),
};
},
);
7 Replies
hk
hk2w ago
Error
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
at /node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:19323:67
at Array.map (<anonymous>)
at prepareAddCompositePrimaryKeyPg (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:19315:33)
at applyPgSnapshotsDiff (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:19825:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async preparePgPush (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:22080:52)
at async pgPush (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:106652:26)
at async Command.<anonymous> (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:113633:7)
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
at /node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:19323:67
at Array.map (<anonymous>)
at prepareAddCompositePrimaryKeyPg (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:19315:33)
at applyPgSnapshotsDiff (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:19825:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async preparePgPush (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:22080:52)
at async pgPush (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:106652:26)
at async Command.<anonymous> (/node_modules/.pnpm/drizzle-kit@0.21.2/node_modules/drizzle-kit/bin.cjs:113633:7)
I got this error only after upgrading to drizzle-kit@0.21.1 and 0.21.2 anything I can do about it? thanks
terlan8892
terlan88922w ago
I keep getting this too please let me know if you did figure out something i've tried using 0.21.1, but the same thing
hk
hk2w ago
@terlan8892 downgraded for now until we get an update from drizzle 😅
terlan8892
terlan88922w ago
to which version did you downgrade too? because it didnt work for me. and did you downgrade just kit package or orm too?
hk
hk2w ago
just the kit to 0.20.18 and if you want to use drizzle studio run studio--port 4983
rphlmr ⚡
rphlmr ⚡2w ago
Hey 👋 can you open an issue on GitHub for that? The team is hardly working on fixes
terlan8892
terlan88922w ago
i did create one yesterday https://github.com/drizzle-team/drizzle-orm/issues/2344 thank you very much for your attention
GitHub
[BUG]: TypeError: Cannot read properties of undefined (reading 'com...
What version of drizzle-orm are you using? 0.30.10 What version of drizzle-kit are you using? 0.21.2 Describe the Bug if I have tables with no composite primary keys(table => pk: primaryKey(.......