Baterka
Baterka
Explore posts from servers
DTDrizzle Team
Created by Baterka on 1/27/2024 in #help
SQL syntax error when using relations in MariaDB
Does anyone else have issue similar to this one? https://github.com/drizzle-team/drizzle-orm/issues/1100 I have this issue on MariaDB 10.4 and also on 11.2. This is my schema:
export const items = mysqlTable('items', {
id: int('id').autoincrement().primaryKey().notNull(),
...
})

export const itemsRelations = relations(items, ({ one }) => ({
trade: one(trades, { fields: [items.tradeId], references: [trades.id] }),
}));

export const trades = mysqlTable('trades', {
id: int('id').autoincrement().primaryKey().notNull(),
...
})

export const tradesRelations = relations(trades, ({ many }) => ({
items: many(items)
}))
export const items = mysqlTable('items', {
id: int('id').autoincrement().primaryKey().notNull(),
...
})

export const itemsRelations = relations(items, ({ one }) => ({
trade: one(trades, { fields: [items.tradeId], references: [trades.id] }),
}));

export const trades = mysqlTable('trades', {
id: int('id').autoincrement().primaryKey().notNull(),
...
})

export const tradesRelations = relations(trades, ({ many }) => ({
items: many(items)
}))
I am getting error:
42000', sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select coalesce(json_arrayagg(json_array(`trades_items`.`id`, `trades_items`...' at line 1"
42000', sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(select coalesce(json_arrayagg(json_array(`trades_items`.`id`, `trades_items`...' at line 1"
when doing trade query with with: {items: true}
10 replies
DTDrizzle Team
Created by Baterka on 1/19/2024 in #help
Getting TypeScript warnings where they should not be
No description
9 replies