useLiveQuery returns wrongly relations queries
I have such piece of code
`
which return properly results
above ☝️ return an empty array, and i have no idea why
here are my schemas
and db definition
do you see anything being wrong here?
const queuedIssues = useLiveQuery(
db.query.issueQueue.findMany({
with: {
issue: true,
},
}),
);
const queuedIssues = useLiveQuery(
db.query.issueQueue.findMany({
with: {
issue: true,
},
}),
);
const queuedIssues = useLiveQuery(
db
.select()
.from(issueQueue)
.leftJoin(issue, eq(issueQueue.issueId, issue.id)),
);
const queuedIssues = useLiveQuery(
db
.select()
.from(issueQueue)
.leftJoin(issue, eq(issueQueue.issueId, issue.id)),
);
import { relations } from "drizzle-orm/relations";
import { integer, sqliteTable } from "drizzle-orm/sqlite-core";
import { issue } from "./issue";
export const issueQueue = sqliteTable("issue_queue", {
id: integer("id").primaryKey(),
issueId: integer("issue_id")
.notNull()
.references(() => issue.id, {
onDelete: "cascade",
}),
});
export const issueQueueRelations = relations(issueQueue, ({ one }) => ({
issue: one(issue, {
fields: [issueQueue.issueId],
references: [issue.id],
}),
}));
export type IssueQueue = typeof issueQueue.$inferSelect;
export type InsertIssueQueue = typeof issueQueue.$inferInsert;
import { relations } from "drizzle-orm/relations";
import { integer, sqliteTable } from "drizzle-orm/sqlite-core";
import { issue } from "./issue";
export const issueQueue = sqliteTable("issue_queue", {
id: integer("id").primaryKey(),
issueId: integer("issue_id")
.notNull()
.references(() => issue.id, {
onDelete: "cascade",
}),
});
export const issueQueueRelations = relations(issueQueue, ({ one }) => ({
issue: one(issue, {
fields: [issueQueue.issueId],
references: [issue.id],
}),
}));
export type IssueQueue = typeof issueQueue.$inferSelect;
export type InsertIssueQueue = typeof issueQueue.$inferInsert;
import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite/next";
import { issue } from "./schema/issue";
import { issueQueue } from "./schema/issue-queue";
const expoDb = openDatabaseSync("db.db", {
enableChangeListener: true,
});
const db = drizzle(expoDb, {
schema: {
issue,
issueQueue,
},
});
export { expoDb, db };
import { drizzle } from "drizzle-orm/expo-sqlite";
import { openDatabaseSync } from "expo-sqlite/next";
import { issue } from "./schema/issue";
import { issueQueue } from "./schema/issue-queue";
const expoDb = openDatabaseSync("db.db", {
enableChangeListener: true,
});
const db = drizzle(expoDb, {
schema: {
issue,
issueQueue,
},
});
export { expoDb, db };
0 Replies