-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
240 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const meta = { | ||
"mastra-storage": "Mastra Storage", | ||
libsql: "LibSQL Storage", | ||
postgresql: "PostgreSQL Storage", | ||
upstash: "Upstash Storage", | ||
}; | ||
|
||
export default meta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
title: "LibSQL Storage | Storage System | Mastra Core" | ||
description: Documentation for the LibSQL storage implementation in Mastra. | ||
--- | ||
|
||
# LibSQL Storage | ||
|
||
The LibSQL storage implementation provides a SQLite-compatible storage solution that can run both in-memory and as a persistent database. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @mastra/storage-libsql | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript copy showLineNumbers | ||
import { LibSQLStorage } from "@mastra/storage-libsql"; | ||
|
||
// In-memory database (development) | ||
const storage = new LibSQLStorage({ | ||
url: "file::memory:?cache=shared" | ||
}); | ||
|
||
// Persistent database (production) | ||
const storage = new LibSQLStorage({ | ||
url: process.env.DATABASE_URL | ||
}); | ||
``` | ||
|
||
## Parameters | ||
|
||
<PropertiesTable | ||
content={[ | ||
{ | ||
name: "url", | ||
type: "string", | ||
description: "Database URL. Use 'file::memory:?cache=shared' for in-memory database or a LibSQL-compatible connection string for persistent storage.", | ||
isOptional: false, | ||
}, | ||
{ | ||
name: "authToken", | ||
type: "string", | ||
description: "Authentication token for remote LibSQL databases.", | ||
isOptional: true, | ||
} | ||
]} | ||
/> | ||
|
||
## Additional Notes | ||
|
||
### In-Memory vs Persistent Storage | ||
|
||
The in-memory configuration (`file::memory:?cache=shared`) is useful for: | ||
- Development and testing | ||
- Temporary storage that doesn't need to persist | ||
- Quick prototyping | ||
|
||
For production use cases, use a persistent database URL: | ||
- Local file: `file:local.db` | ||
- Remote LibSQL: `libsql://your-database.turso.io` | ||
|
||
### Schema Management | ||
|
||
The storage implementation handles schema creation and updates automatically. It creates the following tables: | ||
- `threads`: Stores conversation threads | ||
- `messages`: Stores individual messages | ||
- `metadata`: Stores additional metadata for threads and messages |
286 changes: 0 additions & 286 deletions
286
docs/src/pages/docs/reference/storage/mastra-storage.mdx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.