nahtnam
Explore posts from serversDTDrizzle Team
•Created by nahtnam on 10/17/2024 in #help
`pageId` does not exist when inserting, even though it's in the schema
I have the following schema:
and a query
But I get error
export const scrapeStatusEnum = pgEnum("scrape_status", [
"error",
"not-enough-information",
"success",
]);
export const scrapes = pgTable("scrapes", {
id: uuid().defaultRandom().primaryKey(),
...timestamps,
simHash: text().notNull(),
url: text().notNull(),
response: jsonb(),
status: scrapeStatusEnum().notNull(),
metadataId: uuid()
.references(() => metadata.id)
.unique(),
pageId: uuid()
.notNull()
.references(() => pages.id),
});
export const scrapesRelations = relations(scrapes, ({ one }) => ({
metadata: one(metadata, {
fields: [scrapes.metadataId],
references: [metadata.id],
}),
}));
export const scrapeStatusEnum = pgEnum("scrape_status", [
"error",
"not-enough-information",
"success",
]);
export const scrapes = pgTable("scrapes", {
id: uuid().defaultRandom().primaryKey(),
...timestamps,
simHash: text().notNull(),
url: text().notNull(),
response: jsonb(),
status: scrapeStatusEnum().notNull(),
metadataId: uuid()
.references(() => metadata.id)
.unique(),
pageId: uuid()
.notNull()
.references(() => pages.id),
});
export const scrapesRelations = relations(scrapes, ({ one }) => ({
metadata: one(metadata, {
fields: [scrapes.metadataId],
references: [metadata.id],
}),
}));
await db.insert(scrapes).values({
pageId: page.id,
response: object,
simHash,
url,
status,
});
await db.insert(scrapes).values({
pageId: page.id,
response: object,
simHash,
url,
status,
});
error TS2769: No overload matches this call.
Overload 2 of 2, '(values: { status: "error" | "success" | SQL<unknown> | "not-enough-information" | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; ... 6 more ...; metadataId?: string | ... 3 more ... | undefined; }[]): PgInsertBase<...>', gave the following error.
Object literal may only specify known properties, and 'pageId' does not exist in type '{ status: "error" | "success" | SQL<unknown> | "not-enough-information" | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; ... 6 more ...; metadataId?: string | ... 3 more ... | undefined; }[]'.
133 pageId: page.id,
~~~~~~
error TS2769: No overload matches this call.
Overload 2 of 2, '(values: { status: "error" | "success" | SQL<unknown> | "not-enough-information" | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; ... 6 more ...; metadataId?: string | ... 3 more ... | undefined; }[]): PgInsertBase<...>', gave the following error.
Object literal may only specify known properties, and 'pageId' does not exist in type '{ status: "error" | "success" | SQL<unknown> | "not-enough-information" | Placeholder<string, any>; url: string | SQL<unknown> | Placeholder<string, any>; ... 6 more ...; metadataId?: string | ... 3 more ... | undefined; }[]'.
133 pageId: page.id,
~~~~~~
5 replies