geometry not available on 'drizzle-orm/pg-core'

The documentation says that the geometry from PostGIS can be imported from the pg-core library, but I am unable to.
5 Replies
rphlmr ⚡
rphlmr ⚡2mo ago
Are you on the latest?
rphlmr ⚡
rphlmr ⚡2mo ago
GitHub
drizzle-orm/drizzle-orm/src/pg-core/columns/postgis_extension/geome...
Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅 - drizzle-team/drizzle-orm
howtonity
howtonity2mo ago
Ok, I got the latest version of drizzle and was able to access geometry.
import { geometry, index, pgTable, serial, text } from "drizzle-orm/pg-core";
export const stores = pgTable(
"stores",
{
id: serial("id").primaryKey(),
name: text("name").notNull(),
location: geometry("location", {
type: "point",
mode: "xy",
srid: 4326,
}).notNull(),
},
(t) => ({
spatialIndex: index("spatial_index").using("gist", t.location),
}),
);
import { geometry, index, pgTable, serial, text } from "drizzle-orm/pg-core";
export const stores = pgTable(
"stores",
{
id: serial("id").primaryKey(),
name: text("name").notNull(),
location: geometry("location", {
type: "point",
mode: "xy",
srid: 4326,
}).notNull(),
},
(t) => ({
spatialIndex: index("spatial_index").using("gist", t.location),
}),
);
When I try to follow the examples, I get the error: Unsafe call of an error type typed value. I am using the t3-stack with drizzle, I don't know if the way any of it is setup is causing this issue.
rphlmr ⚡
rphlmr ⚡2mo ago
I have never seen this error but can you share the stack trace? Maybe we will find what is throwing this error
howtonity
howtonity2mo ago
nvm, it was just an eslint issue. I just had to update all my packages.
Want results from more Discord servers?
Add your server