执行 npx drizzle-kit migrate
命令报错:
No config path provided, using default 'drizzle.config.ts'
Reading config file 'E:\nextjs-cloudflare-drizzle\drizzle.config.ts'
Using 'postgres' driver for database querying
[⡿] applying migrations...PostgresError: no pg_hba.conf entry for host "xx.xx.xx.xx", user "postgres", database "database_name", no encryption
at ErrorResponse (file:///E:/nextjs-cloudflare-drizzle/node_modules/postgres/src/connection.js:788:26)
at handle (file:///E:/nextjs-cloudflare-drizzle/node_modules/postgres/src/connection.js:474:6)
at Socket.data (file:///E:/nextjs-cloudflare-drizzle/node_modules/postgres/src/connection.js:315:9)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:545:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:495:3)
at Readable.push (node:internal/streams/readable:375:5)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
severity_local: 'FATAL',
severity: 'FATAL',
code: '28000',
file: 'auth.c',
line: '630',
routine: 'ClientAuthentication'
}
需要在 服务器参数
里,将 require_secure_transport
修改为 off
,点击保存后重新部署,再次执行数据库迁移命令。
npx drizzle-kit migrate
No config path provided, using default 'drizzle.config.ts'
Reading config file 'E:\nextjs-cloudflare-drizzle\drizzle.config.ts'
Using 'postgres' driver for database querying
[✓] migrations applied successfully!