chore: bump the drizzle and user new pool client.

This commit is contained in:
Yufan Sheng 2024-10-16 10:40:23 +08:00
parent 566334daf5
commit 502ac91327
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B
3 changed files with 38 additions and 45 deletions

44
package-lock.json generated
View File

@ -10,10 +10,10 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@astrojs/mdx": "^3.1.8", "@astrojs/mdx": "^3.1.8",
"@astrojs/rss": "^4.0.8", "@astrojs/rss": "^4.0.9",
"@zeabur/astro-adapter": "^1.0.6", "@zeabur/astro-adapter": "^1.0.6",
"astro": "^4.16.4", "astro": "^4.16.5",
"drizzle-orm": "^0.34.1", "drizzle-orm": "^0.35.0",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"luxon": "^3.5.0", "luxon": "^3.5.0",
@ -205,9 +205,9 @@
} }
}, },
"node_modules/@astrojs/rss": { "node_modules/@astrojs/rss": {
"version": "4.0.8", "version": "4.0.9",
"resolved": "https://registry.npmjs.org/@astrojs/rss/-/rss-4.0.8.tgz", "resolved": "https://registry.npmjs.org/@astrojs/rss/-/rss-4.0.9.tgz",
"integrity": "sha512-63UYWS2xj00+N79JPiLeHiBBB3nHfjFlJ81T9a+UaYQ7aUZyvU0E9JdZeuONwHKKcSsvP+goPjWmoVifPToRGA==", "integrity": "sha512-W1qeLc/WP1vMS5xXa+BnaLU0paeSeGjN8RJVAoBaOIkQuKXjIUA9hvPno89heo73in5i67g40gy70oeeHMqp6A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-xml-parser": "^4.5.0", "fast-xml-parser": "^4.5.0",
@ -2910,9 +2910,9 @@
} }
}, },
"node_modules/astro": { "node_modules/astro": {
"version": "4.16.4", "version": "4.16.5",
"resolved": "https://registry.npmjs.org/astro/-/astro-4.16.4.tgz", "resolved": "https://registry.npmjs.org/astro/-/astro-4.16.5.tgz",
"integrity": "sha512-W/ETxHRkt9iEAj1RVSqV3bjSGaGXEFJHqeNpPhvJIj720hC3V/ZBDAd6FpMW291eiZPtxhGh+c/VDtkD6avPXQ==", "integrity": "sha512-v8mKWcEPN7hkfyVsMFWV0F8UgL4GUJKT172KTB7dePO3yJb64HBwCckC0QnA60QQh3jK6+2xwyWEc5QvCeqjtg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@astrojs/compiler": "^2.10.3", "@astrojs/compiler": "^2.10.3",
@ -3813,9 +3813,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/drizzle-orm": { "node_modules/drizzle-orm": {
"version": "0.34.1", "version": "0.35.0",
"resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.34.1.tgz", "resolved": "https://registry.npmjs.org/drizzle-orm/-/drizzle-orm-0.35.0.tgz",
"integrity": "sha512-t+zCwyWWt8xTqtYV4doE/xYmT7hpv1L8pQ66zddEz+3VWyedBBtctjMAp22mAJPfyWurRQXUJ1nrTtqLq+DqNA==", "integrity": "sha512-fyTKnQ6WZQqSUy6yM4Do2tJPBg1ALR0vJtO9xUTLLubD+0qS1PPuu8aVOeLZQo+g8RPJn+Vqoh30/3lSS8/a2w==",
"license": "Apache-2.0", "license": "Apache-2.0",
"peerDependencies": { "peerDependencies": {
"@aws-sdk/client-rds-data": ">=3", "@aws-sdk/client-rds-data": ">=3",
@ -3950,9 +3950,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.38", "version": "1.5.39",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.38.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.39.tgz",
"integrity": "sha512-VbeVexmZ1IFh+5EfrYz1I0HTzHVIlJa112UEWhciPyeOcKJGeTv6N8WnG4wsQB81DGCaVEGhpSb6o6a8WYFXXg==", "integrity": "sha512-4xkpSR6CjuiaNyvwiWDI85N9AxsvbPawB8xc7yzLPonYTuP19BVgYweKyUMFtHEZgIcHWMt1ks5Cqx2m+6/Grg==",
"license": "ISC" "license": "ISC"
}, },
"node_modules/emmet": { "node_modules/emmet": {
@ -4190,11 +4190,11 @@
} }
}, },
"node_modules/fast-uri": { "node_modules/fast-uri": {
"version": "3.0.2", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.2.tgz", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.3.tgz",
"integrity": "sha512-GR6f0hD7XXyNJa25Tb9BuIdN0tdr+0BMi6/CJPH3wJO1JjNG3n/VsSw38AwRdKZABm8lGbPfakLRkYzx2V9row==", "integrity": "sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw==",
"dev": true, "dev": true,
"license": "MIT" "license": "BSD-3-Clause"
}, },
"node_modules/fast-xml-parser": { "node_modules/fast-xml-parser": {
"version": "4.5.0", "version": "4.5.0",
@ -8541,9 +8541,9 @@
} }
}, },
"node_modules/tslib": { "node_modules/tslib": {
"version": "2.7.0", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz",
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==",
"dev": true, "dev": true,
"license": "0BSD", "license": "0BSD",
"optional": true "optional": true

View File

@ -43,10 +43,10 @@
}, },
"dependencies": { "dependencies": {
"@astrojs/mdx": "^3.1.8", "@astrojs/mdx": "^3.1.8",
"@astrojs/rss": "^4.0.8", "@astrojs/rss": "^4.0.9",
"@zeabur/astro-adapter": "^1.0.6", "@zeabur/astro-adapter": "^1.0.6",
"astro": "^4.16.4", "astro": "^4.16.5",
"drizzle-orm": "^0.34.1", "drizzle-orm": "^0.35.0",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"luxon": "^3.5.0", "luxon": "^3.5.0",

View File

@ -7,27 +7,20 @@ import {
POSTGRES_USERNAME, POSTGRES_USERNAME,
} from 'astro:env/server'; } from 'astro:env/server';
import { drizzle } from 'drizzle-orm/node-postgres'; import { drizzle } from 'drizzle-orm/node-postgres';
import pg from 'pg'; import type { PoolConfig } from 'pg';
/** export const db = drizzle({
* Cache the database connection in development. This avoids creating a new connection on every HMR update. connection: {
*/
const globalForDb = globalThis as unknown as {
conn: pg.Pool | undefined;
};
const conn =
globalForDb.conn ??
new pg.Pool({
host: POSTGRES_HOST,
port: POSTGRES_PORT,
user: POSTGRES_USERNAME, user: POSTGRES_USERNAME,
password: POSTGRES_PASSWORD, password: POSTGRES_PASSWORD,
database: POSTGRES_DATABASE, host: POSTGRES_HOST,
port: POSTGRES_PORT,
db: POSTGRES_DATABASE,
keepAlive: true, keepAlive: true,
max: 10,
min: 1,
allowExitOnIdle: true,
} as PoolConfig,
schema: schema,
logger: false,
}); });
// Cache the connection.
globalForDb.conn = conn;
export const db = drizzle(conn, { schema: schema, logger: false });