Getting error NeonDbError when pushing migration file

Hi all, So i have a schema that defines custom type JSON objects for my NeonDB database, like so:
type Address = {
street: string;
city: string;
state: string;
zip: string;
};
type Address = {
street: string;
city: string;
state: string;
zip: string;
};
And I am trying to use it like so:
export const Organizations = vendorPortalSchema.table('organizations', {
id: serial("id").primaryKey(),
name: text("name").unique().notNull(),
description: text("description"),
location: json("location").$type<Address>(),
logo_picture_file_id: serial("logo_picture_file_id").references(
(): AnyPgColumn => Files.id
),
});
export const Organizations = vendorPortalSchema.table('organizations', {
id: serial("id").primaryKey(),
name: text("name").unique().notNull(),
description: text("description"),
location: json("location").$type<Address>(),
logo_picture_file_id: serial("logo_picture_file_id").references(
(): AnyPgColumn => Files.id
),
});
However, I am getting an error NeonDbError: data type json has no default operator class for access method "btree" So perhaps I am not specifying the custom type of json correctly, but I could not find any examples on the drizzle website. I also tried like (commads instead of semi-colons):
type Address = {
street: string,
city: string,
state: string,
zip: string,
};
type Address = {
street: string,
city: string,
state: string,
zip: string,
};
But it still lead to the same error. Any thoughts on how to do this properly? Thank you!
3 Replies
Mykhailo
Mykhailo11mo ago
Hello, @Nick Montoya! Is it possible to provide reproduction repo? I couldn't reproduce it on my end. I am using latest version of drizzle-orm
No description
Nicolas
NicolasOP11mo ago
Hi Solo, i seem have had a unique() on another json property that was causing this error, I got it working without including the unique(), it seems for that you need jsonb
Mykhailo
Mykhailo11mo ago
super
Want results from more Discord servers?
Add your server