One-to-one relations

So, uh, I can't figure out why i keep getting this annoying message:
ERROR: could not identify an equality operator for type json at character 716.
ERROR: could not identify an equality operator for type json at character 716.
Here is a schema:
export const dungeon = pgTable('dungeon', {
id: serial('id').primaryKey(),
image: json('image'),
name: varchar('name', { length: 256 }),
gameId: integer('game_id').notNull().references(() => game.id, { onDelete: 'cascade' }),
bossId: integer('boss_id').references(() => boss.id, { onDelete: 'cascade' }),
});

export const boss = pgTable('boss', {
id: serial('id').primaryKey(),
hp: integer('hp'),
name: varchar('name', { length: 256 }),
image: json('image'),
});

export const dungeonRelations = relations(dungeon, ({ many, one }) => ({
monsters: many(monster),
gameId: one(game, { fields: [dungeon.gameId], references: [game.id] }),
boss: one(boss, { fields: [dungeon.bossId], references: [boss.id] }),
}));
export const dungeon = pgTable('dungeon', {
id: serial('id').primaryKey(),
image: json('image'),
name: varchar('name', { length: 256 }),
gameId: integer('game_id').notNull().references(() => game.id, { onDelete: 'cascade' }),
bossId: integer('boss_id').references(() => boss.id, { onDelete: 'cascade' }),
});

export const boss = pgTable('boss', {
id: serial('id').primaryKey(),
hp: integer('hp'),
name: varchar('name', { length: 256 }),
image: json('image'),
});

export const dungeonRelations = relations(dungeon, ({ many, one }) => ({
monsters: many(monster),
gameId: one(game, { fields: [dungeon.gameId], references: [game.id] }),
boss: one(boss, { fields: [dungeon.bossId], references: [boss.id] }),
}));
And here is a query variable:
const dungeons = await db.query.dungeon.findMany({
where: eq(dungeon.gameId, id),
with: {
monsters: true,
boss: true, <-- Without this, query working perfectly fine, so...
},
});
const dungeons = await db.query.dungeon.findMany({
where: eq(dungeon.gameId, id),
with: {
monsters: true,
boss: true, <-- Without this, query working perfectly fine, so...
},
});
P.S. I love that error message ._.
1 Reply
Chris Pratt
Chris PrattOP17mo ago
Problem solved by downloading 0.28.0 update
Want results from more Discord servers?
Add your server