Tomathy
Tomathy
DTDrizzle Team
Created by Tomathy on 9/2/2024 in #help
No overload matches this call
but the enum is composed of strings. Is there a way to export/import the enums type and how do I insert enum values into the table?
12 replies
DTDrizzle Team
Created by Tomathy on 9/2/2024 in #help
No overload matches this call
Tried it, but gives the same error but for a different attribute? It's so weird seeing as the first error was for "name" and not the bytea attribute. Nw it's just pointing out the enum 🤔 Here's the new schema:
export const clients = pgTable("clients",{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }).notNull(),
nif: char("nif", { length: 9}).unique().notNull(),
password: varchar("password", {length: 256}).unique().notNull(),
email: varchar("email", { length: 256}).unique(),
rf_taxrep: rfEnum("rf_taxrep"),
activity: activityEnum("activity").notNull(),
obs: text("obs"),
services: serial("services").references(() => service.id, {onDelete: "cascade"}),
})
export const clients = pgTable("clients",{
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }).notNull(),
nif: char("nif", { length: 9}).unique().notNull(),
password: varchar("password", {length: 256}).unique().notNull(),
email: varchar("email", { length: 256}).unique(),
rf_taxrep: rfEnum("rf_taxrep"),
activity: activityEnum("activity").notNull(),
obs: text("obs"),
services: serial("services").references(() => service.id, {onDelete: "cascade"}),
})
Here's the new error: No overload matches this call. Overload 1 of 2, '(value: { name: string | SQL<unknown> | Placeholder<string, any>; nif: string | SQL<unknown> | Placeholder<string, any>; password: string | SQL<unknown> | Placeholder<...>; ... 5 more ...; services?: number | ... 2 more ... | undefined; }): PgInsertBase<...>', gave the following error. Type 'string' is not assignable to type 'SQL<unknown> | "ATIVO" | "NÃO ATIVO" | "SUSPENSO" | Placeholder<string, any>'. Overload 2 of 2, '(values: { name: string | SQL<unknown> | Placeholder<string, any>; nif: string | SQL<unknown> | Placeholder<string, any>; password: string | SQL<unknown> | Placeholder<...>; ... 5 more ...; services?: number | ... 2 more ... | undefined; }[]): PgInsertBase<...>', gave the following error. Object literal may only specify known properties, and 'name' does not exist in type '{ name: string | SQL<unknown> | Placeholder<string, any>; nif: string | SQL<unknown> | Placeholder<string, any>; ... (Discord limit)
12 replies
DTDrizzle Team
Created by Tomathy on 9/2/2024 in #help
No overload matches this call
const bytea = customType<{ data: Buffer; notNull: false; default: false }>({
dataType() {
return "bytea";
},
});
const bytea = customType<{ data: Buffer; notNull: false; default: false }>({
dataType() {
return "bytea";
},
});
From the error message, it seems it's not recognizing name as an attribute :/
12 replies
DTDrizzle Team
Created by Tomathy on 9/2/2024 in #help
No overload matches this call
no, just a single project
12 replies