diff --git a/changelogs/drizzle-orm/0.30.7.md b/changelogs/drizzle-orm/0.30.7.md new file mode 100644 index 000000000..d1e6ab9ca --- /dev/null +++ b/changelogs/drizzle-orm/0.30.7.md @@ -0,0 +1,4 @@ +## Bug fixes + +- Add mappings for `@vercel/postgres` package +- Fix interval mapping for `neon` drivers - #1542 \ No newline at end of file diff --git a/drizzle-orm/package.json b/drizzle-orm/package.json index 5defc8e58..535554ea0 100644 --- a/drizzle-orm/package.json +++ b/drizzle-orm/package.json @@ -1,6 +1,6 @@ { "name": "drizzle-orm", - "version": "0.30.6", + "version": "0.30.7", "description": "Drizzle ORM package for SQL databases", "type": "module", "scripts": { @@ -45,6 +45,7 @@ "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=3", + "@electric-sql/pglite": ">=0.1.1", "@libsql/client": "*", "@neondatabase/serverless": ">=0.1", "@op-engineering/op-sqlite": ">=2", @@ -54,7 +55,7 @@ "@types/pg": "*", "@types/react": ">=18", "@types/sql.js": "*", - "@vercel/postgres": "*", + "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "better-sqlite3": ">=7", "bun-types": "*", @@ -66,8 +67,7 @@ "postgres": ">=3", "react": ">=18", "sql.js": ">=1", - "sqlite3": ">=5", - "@electric-sql/pglite": ">=0.1.1" + "sqlite3": ">=5" }, "peerDependenciesMeta": { "mysql2": { @@ -161,7 +161,7 @@ "@types/pg": "^8.10.1", "@types/react": "^18.2.45", "@types/sql.js": "^1.4.4", - "@vercel/postgres": "^0.3.0", + "@vercel/postgres": "^0.8.0", "@xata.io/client": "^0.29.3", "better-sqlite3": "^8.4.0", "bun-types": "^0.6.6", diff --git a/drizzle-orm/src/neon-serverless/driver.ts b/drizzle-orm/src/neon-serverless/driver.ts index 9f58b0e65..8a15dd678 100644 --- a/drizzle-orm/src/neon-serverless/driver.ts +++ b/drizzle-orm/src/neon-serverless/driver.ts @@ -39,6 +39,7 @@ export class NeonDriver { types.setTypeParser(types.builtins.TIMESTAMPTZ, (val) => val); types.setTypeParser(types.builtins.TIMESTAMP, (val) => val); types.setTypeParser(types.builtins.DATE, (val) => val); + types.setTypeParser(types.builtins.INTERVAL, (val) => val); } } diff --git a/drizzle-orm/src/vercel-postgres/driver.ts b/drizzle-orm/src/vercel-postgres/driver.ts index bdbc49def..07e73c732 100644 --- a/drizzle-orm/src/vercel-postgres/driver.ts +++ b/drizzle-orm/src/vercel-postgres/driver.ts @@ -1,3 +1,4 @@ +import { types } from '@vercel/postgres'; import { entityKind } from '~/entity.ts'; import type { Logger } from '~/logger.ts'; import { DefaultLogger } from '~/logger.ts'; @@ -34,9 +35,10 @@ export class VercelPgDriver { } initMappers() { - // types.setTypeParser(types.builtins.TIMESTAMPTZ, (val) => val); - // types.setTypeParser(types.builtins.TIMESTAMP, (val) => val); - // types.setTypeParser(types.builtins.DATE, (val) => val); + types.setTypeParser(types.builtins.TIMESTAMPTZ, (val) => val); + types.setTypeParser(types.builtins.TIMESTAMP, (val) => val); + types.setTypeParser(types.builtins.DATE, (val) => val); + types.setTypeParser(types.builtins.INTERVAL, (val) => val); } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b524cc1cc..aef9daacd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -131,8 +131,8 @@ importers: specifier: ^1.4.4 version: 1.4.4 '@vercel/postgres': - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.8.0 + version: 0.8.0 '@xata.io/client': specifier: ^0.29.3 version: 0.29.3(typescript@5.2.2) @@ -3756,7 +3756,7 @@ packages: text-table: 0.2.0 url-join: 4.0.0 wrap-ansi: 7.0.0 - ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@6.0.3) + ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) transitivePeerDependencies: - bluebird - bufferutil @@ -4252,7 +4252,7 @@ packages: resolution: {integrity: sha512-DtLWIH29onUYR00i0GlQ3UdcTRC6EP4u9w/h9LxpUZJWRMARk6dQwZ6Jkd+QdwVpuAOrdxt18v0K2uIYR3fwFg==} dependencies: '@types/ws': 8.5.4 - ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@6.0.3) + ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -4364,6 +4364,13 @@ packages: resolution: {integrity: sha512-U8tpuF5f0R5WRsciR7iaJ5S2h54DWa6Z6CEW+J4KgwyvRN3q3qDz0MibdfFXU0WqnRoi/9RSf/2XN4TfeaOCbQ==} dependencies: '@types/pg': 8.10.1 + dev: false + + /@neondatabase/serverless@0.7.2: + resolution: {integrity: sha512-wU3WA2uTyNO7wjPs3Mg0G01jztAxUxzd9/mskMmtPwPTjf7JKWi9AW5/puOGXLxmZ9PVgRFeBVRVYq5nBPhsCg==} + dependencies: + '@types/pg': 8.6.6 + dev: true /@neondatabase/serverless@0.9.0: resolution: {integrity: sha512-mmJnUAzlzvxNSZuuhI6kgJjH+JgFdBMYUWxihtq/nj0Tjt+Y5UU3W+SvRFoucnd5NObYkuLYQzk+zV5DGFKGJg==} @@ -5570,6 +5577,17 @@ packages: bufferutil: 4.0.7 utf-8-validate: 6.0.3 ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@6.0.3) + dev: false + + /@vercel/postgres@0.8.0: + resolution: {integrity: sha512-/QUV9ExwaNdKooRjOQqvrKNVnRvsaXeukPNI5DB1ovUTesglfR/fparw7ngo1KUWWKIVpEj2TRrA+ObRHRdaLg==} + engines: {node: '>=14.6'} + dependencies: + '@neondatabase/serverless': 0.7.2 + bufferutil: 4.0.8 + utf-8-validate: 6.0.3 + ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) + dev: true /@vitest/expect@0.31.4: resolution: {integrity: sha512-tibyx8o7GUyGHZGyPgzwiaPaLDQ9MMuCOrc03BYT0nryUuhLbL7NV2r/q98iv5STlwMgaKuFJkgBW/8iPKwlSg==} @@ -6445,6 +6463,14 @@ packages: requiresBuild: true dependencies: node-gyp-build: 4.6.0 + dev: false + + /bufferutil@4.0.8: + resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} + engines: {node: '>=6.14.2'} + requiresBuild: true + dependencies: + node-gyp-build: 4.6.0 /buildcheck@0.0.6: resolution: {integrity: sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==} @@ -14702,6 +14728,22 @@ packages: dependencies: bufferutil: 4.0.7 utf-8-validate: 6.0.3 + dev: false + + /ws@8.14.2(bufferutil@4.0.8)(utf-8-validate@6.0.3): + resolution: {integrity: sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dependencies: + bufferutil: 4.0.8 + utf-8-validate: 6.0.3 /xcode@3.0.1: resolution: {integrity: sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==}