many to many relation with uuid's

i'm trying to create a many to many relation with uuids. if i try to push the changes to the database (pg) i got the following error:
error: column "userId" cannot be cast automatically to type uuid
{
length: 179,
severity: 'ERROR',
code: '42804',
detail: undefined,
hint: 'You might need to specify "USING "userId"::uuid".',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'tablecmds.c',
line: '12324',
routine: 'ATPrepAlterColumnType'
}
error: column "userId" cannot be cast automatically to type uuid
{
length: 179,
severity: 'ERROR',
code: '42804',
detail: undefined,
hint: 'You might need to specify "USING "userId"::uuid".',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'tablecmds.c',
line: '12324',
routine: 'ATPrepAlterColumnType'
}
my code looks like this:
export const projectMembersTable = pgTable('projectMembers', {
userId: uuid('userId').references(() => userTable.id),
projectId: uuid('projectId').references(() => projectTable.id),
}, (t) => ({
pk: primaryKey(t.userId, t.projectId),
}),
);
export const projectMembersTable = pgTable('projectMembers', {
userId: uuid('userId').references(() => userTable.id),
projectId: uuid('projectId').references(() => projectTable.id),
}, (t) => ({
pk: primaryKey(t.userId, t.projectId),
}),
);
userTable.id and projectTable.id are both uuid's do have someone any clou why i get this error?
1 Reply
HashDot
HashDotOP14mo ago
if i use the migrations it works. the error only happens if i use the push function
Want results from more Discord servers?
Add your server