pgvector / pgvector-node

pgvector support for Node.js, Deno, and Bun (and TypeScript)
MIT License
303 stars 9 forks source link

Complete Drizzle ORM support #10

Closed avanderbergh closed 1 year ago

avanderbergh commented 1 year ago

I'm really keen on getting pgvector supported in drizzle-orm and drizzle-kit.

There's an open issue on drizzle-kit to hopefully make the current experimental implementation work https://github.com/drizzle-team/drizzle-kit-mirror/issues/115

I see this is planned for the 0.1.5 release.

Is it possible to perhaps publish the upcoming releases under a @next tag so we could use it with workarounds?

ankane commented 1 year ago

Hi @avanderbergh, thanks for raising the issue with Drizzle Kit. You can point your package.json to GitHub to use unreleased changes.

jschuur commented 1 year ago

Hi @avanderbergh, thanks for raising the issue with Drizzle Kit. You can point your package.json to GitHub to use unreleased changes.

I'm listing the current version from GitHub as an npm dependency, but get a TypeScript error importing from pgvector/drizzle-orm

// Cannot find module 'pgvector/drizzle-orm' or its corresponding type declarations.ts(2307)
import { l2Distance } from 'pgvector/drizzle-orm';

I was able to get around it with declare module 'pgvector/drizzle-orm'; in a .d.ts file in the mean time at least.

ankane commented 1 year ago

Hmm, the types are in types/drizzle-orm/index.d.ts, which is referenced in package.json.

jschuur commented 1 year ago

Hmm, the types are in types/drizzle-orm/index.d.ts, which is referenced in package.json.

If you'd like to replicate it locally, rename global.d.ts in this repo and visit src/db/db.ts.

hyusetiawan commented 1 year ago

yeah it'd be great to get the drizzle support to a "productive" state at least so we can continue evaluating until future releases :)

ankane commented 1 year ago

Just pushed 0.1.5 with experimental support.

@jschuur The release also adds support for "moduleResolution": "node", which should fix the import error.