feat: 添加 Vercel Postgres 数据库支持
- 安装 @vercel/postgres 和 pg 依赖 - 创建 PostgresAdapter 适配器,兼容 D1 接口 - 创建 PostgresStorage 类,实现完整的 IStorage 接口 - 添加 Postgres 数据库初始化脚本和 schema - 更 next.config.js 排除 Postgres 模块的客户端打包 - 添加 VERCEL_DEPLOYMENT.md 部署指南 - 支持 Vercel serverless 环境部署 注意事项:观影室功能在 Vercel 上不可用(需要 WebSocket 支持)
This commit is contained in:
+5
-1
@@ -71,11 +71,13 @@ const nextConfig = {
|
||||
crypto: false,
|
||||
};
|
||||
|
||||
// Exclude better-sqlite3 and D1 modules from client-side bundle
|
||||
// Exclude better-sqlite3, D1, and Postgres modules from client-side bundle
|
||||
if (!isServer) {
|
||||
config.externals = config.externals || [];
|
||||
config.externals.push({
|
||||
'better-sqlite3': 'commonjs better-sqlite3',
|
||||
'@vercel/postgres': 'commonjs @vercel/postgres',
|
||||
'pg': 'commonjs pg',
|
||||
});
|
||||
|
||||
config.resolve.alias = {
|
||||
@@ -83,6 +85,8 @@ const nextConfig = {
|
||||
'better-sqlite3': false,
|
||||
'@/lib/d1.db': false,
|
||||
'@/lib/d1-adapter': false,
|
||||
'@/lib/postgres.db': false,
|
||||
'@/lib/postgres-adapter': false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user