feat: add Turso (libSQL) storage support for EdgeOne deployment
- Add TursoAdapter implementing DatabaseAdapter interface using @libsql/client - Add 'turso' storage type to db.ts storage selector (reuses D1Storage) - Add init-turso.js script for database migration and admin initialization - Add @libsql/client dependency to package.json - Update next.config.js to exclude @libsql/client from client-side bundle - Update edgeone-deploy.yml workflow with TURSO_URL and TURSO_TOKEN secrets - Update edgeone-build.mjs runtime env keys to include Turso variables - Update .env.edgeone.example with Turso deployment instructions - Update README.md with Turso as recommended storage for EdgeOne Turso provides free SQLite-compatible cloud database (libSQL) with: - 500 databases, 9GB storage, 1B row reads/month on free tier - HTTP API compatible with edge/serverless environments - Full SQLite syntax compatibility, reuses existing migrations
This commit is contained in:
+3
-1
@@ -136,13 +136,14 @@ const createNextConfig = (phase) => {
|
||||
});
|
||||
}
|
||||
|
||||
// Exclude better-sqlite3, D1, and Postgres modules from client-side bundle
|
||||
// Exclude better-sqlite3, D1, Postgres, and Turso 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',
|
||||
'@libsql/client': 'commonjs @libsql/client',
|
||||
});
|
||||
|
||||
config.resolve.alias = {
|
||||
@@ -152,6 +153,7 @@ const createNextConfig = (phase) => {
|
||||
'@/lib/d1-adapter': false,
|
||||
'@/lib/postgres.db': false,
|
||||
'@/lib/postgres-adapter': false,
|
||||
'@/lib/turso-adapter': false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user