cebollo3
cebollo3
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
From 0.21.4 I can still reproduce the issue. Example schema:
export const testTable1 = pgTable("test_table", {
testId2: uuid("test_id2").primaryKey(),
});

export const testTable2 = pgTable("test_2", {
versionId: uuid("test_id2").primaryKey(),
});

export const bridgeTable = pgTable(
"bridge_table_some_name",
{
v1Id: uuid("bbbb_bbbbb_bbbb_test").references(
() => testTable2.versionId
),
v2Id: uuid("aaa_aaaaaa_aaaa_test").references(
() => testTable1.testId2
),
},
(table) => {
return {
pk: primaryKey({ columns: [table.v1Id, table.v2Id] }),
};
}
);
export const testTable1 = pgTable("test_table", {
testId2: uuid("test_id2").primaryKey(),
});

export const testTable2 = pgTable("test_2", {
versionId: uuid("test_id2").primaryKey(),
});

export const bridgeTable = pgTable(
"bridge_table_some_name",
{
v1Id: uuid("bbbb_bbbbb_bbbb_test").references(
() => testTable2.versionId
),
v2Id: uuid("aaa_aaaaaa_aaaa_test").references(
() => testTable1.testId2
),
},
(table) => {
return {
pk: primaryKey({ columns: [table.v1Id, table.v2Id] }),
};
}
);
Running the schema on an empty database works, running it a second time fails with the error
[✓] Pulling schema from database...TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
at /node_modules/drizzle-kit/bin.cjs:19393:67
at Array.map (<anonymous>)
at prepareDeleteCompositePrimaryKeyPg (/node_modules/drizzle-kit/bin.cjs:19387:33)
at applyPgSnapshotsDiff (/node_modules/drizzle-kit/bin.cjs:19890:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async preparePgPush /node_modules/drizzle-kit/bin.cjs:22139:52)
at async pgPush (/node_modules/drizzle-kit/bin.cjs:114468:26)
at async Command.<anonymous> (/node_modules/drizzle-kit/bin.cjs:121480:7)
[✓] Pulling schema from database...TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
at /node_modules/drizzle-kit/bin.cjs:19393:67
at Array.map (<anonymous>)
at prepareDeleteCompositePrimaryKeyPg (/node_modules/drizzle-kit/bin.cjs:19387:33)
at applyPgSnapshotsDiff (/node_modules/drizzle-kit/bin.cjs:19890:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async preparePgPush /node_modules/drizzle-kit/bin.cjs:22139:52)
at async pgPush (/node_modules/drizzle-kit/bin.cjs:114468:26)
at async Command.<anonymous> (/node_modules/drizzle-kit/bin.cjs:121480:7)
The names of the tables seem to matter. Switching, for example, the bridge table name to 'bridge_table' I can get Pulling schema from database...error: column "bbbb_bbbbb_bbbb_test" is in a primary key Hope this helps. All tables are in the 'public' schema.
44 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
No description
44 replies