MANTA Internal SQLite Database
For MANTA, the SQLite database serves as the backbone for user management, chat history, file storage, and various other core functionalities. Understanding this structure is essential for anyone looking to contribute to or maintain the project effectively.
Internal SQLite Locationβ
You can find the SQLite database at root -> data -> webui.db
π Root (/)
βββ π data
β βββ π cache
β βββ π uploads
β βββ π vector_db
β βββ π webui.db
βββ π dev.sh
βββ π manta
βββ π requirements.txt
βββ π start.sh
βββ π start_windows.bat
Copy Database Locallyβ
If you want to copy the MANTA SQLite database running in the container to your local machine, you can use:
docker cp manta:/app/backend/data/webui.db ./webui.db
Alternatively, you can access the database within the container using:
docker exec -it manta /bin/sh
Table Overviewβ
Here is a complete list of tables in MANTA's SQLite database. The tables are listed alphabetically and numbered for convenience.
| No. | Table Name | Description |
|---|
| 01 | agreement | Stores stores metadata about legal documents |
| 02 | auth | Stores user authentication credentials and login information |
| 03 | channel | Manages chat channels and their configurations |
| 04 | chat | Stores chat sessions and their metadata |
| 05 | config | Maintains system-wide configuration settings |
| 06 | feedback | Captures user feedback and ratings |
| 07 | file | Manages uploaded files and their metadata |
| 08 | folder | Organizes files and content into hierarchical structures |
| 09 | function | Stores custom functions and their configurations |
| 10 | group | Stores group definitions and permissions |
| 11 | group_membership | Stores which users belong to which groups |
| 12 | invoice | Stores billing records |
| 13 | invoice_item | Stores individual line items linked to an invoice |
| 14 | knowledge | Stores knowledge base entries and related information |
| 15 | memory | Maintains chat history and context memory |
| 16 | message | Stores individual chat messages and their content |
| 17 | message_reaction | Records user reactions (emojis/responses) to messages |
| 18 | model | Manages AI model configurations and settings |
| 19 | model_catalog | Manages AI model metadata |
| 20 | model_price | Stores token pricing (input/output) and price validity period |
| 21 | notification_template | Stores notification templates |
| 22 | prompt | Stores templates and configurations for AI prompts |
| 23 | subscription | Represents subscription metadata such as tier name, billing period, status |
| 24 | subscription_price | Defines pricing information for subscription tiers. |
| 25 | tag | Manages tags/labels for content categorization |
| 26 | token_tracking | Records token usage metrics for monitoring and analytics. |
| 27 | tool | Stores configurations for system tools and integrations |
| 28 | user | Maintains user profiles and account information |
| 29 | user_agreement | Tracks which agreements a user has accepted |
| 30 | user_payment_status | Indicates the current payment state of the user |
| 31 | user_subscription | Represents the userβs active subscription plan |
Note: there is additional table in MANTA's SQLite database that is not related to MANTA's core functionality, that have been excluded:
Now that we have all the tables, let's understand the structure of each table.
Agreement Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | BigInteger | PRIMARY KEY | Unique identifier |
| doc_type | Text | NOT NULL | Specifies the document type |
| title | Text | NOT NULL | Document title |
| description | Text | - | Document description |
| version | Text | NOT NULL | Document version |
| url | Text | NOT NULL | Document url |
| created_at | DateTime | NOT NULL | Creation timestamp |
Things to know about the auth table:
- One-to-Many relationship with
users-agreements table (shared id)
doc_type value must be one of ALLOWED_DOC_TYPES
Auth Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier |
| email | Text | - | User's email |
| password | Text | - | Hashed password |
| active | Boolean | - | Account status |
Things to know about the auth table:
- Uses UUID for primary key
- One-to-One relationship with
users table (shared id)
Channel Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| user_id | Text | - | Owner/creator of channel |
| type | Text | nullable | Channel type |
| name | Text | - | Channel name |
| description | Text | nullable | Channel description |
| data | JSON | nullable | Flexible data storage |
| meta | JSON | nullable | Channel metadata |
| access_control | JSON | nullable | Permission settings |
| created_at | BigInteger | - | Creation timestamp (nanoseconds) |
| updated_at | BigInteger | - | Last update timestamp (nanoseconds) |
Things to know about the auth table:
- Uses UUID for primary key
- Case-insensitive channel names (stored lowercase)
Chat Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| user_id | Text | - | Owner of the chat |
| title | Text | - | Chat title |
| chat | JSON | - | Chat content and history |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
| share_id | Text | UNIQUE, nullable | Sharing identifier |
| archived | Boolean | default=False | Archive status |
| pinned | Boolean | default=False, nullable | Pin status |
| meta | JSON | server_default="" | Metadata including tags |
| folder_id | Text | nullable | Parent folder ID |
| Column Name | Data Type | Constraints | Default | Description |
|---|
| id | INTEGER | NOT NULL | - | Primary key identifier |
| data | JSON | NOT NULL | - | Configuration data |
| version | INTEGER | NOT NULL | - | Config version number |
| created_at | DATETIME | NOT NULL | CURRENT_TIMESTAMP | Creation timestamp |
| updated_at | DATETIME | - | CURRENT_TIMESTAMP | Last update timestamp |
Feedback Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| user_id | Text | - | User who provided feedback |
| version | BigInteger | default=0 | Feedback version number |
| type | Text | - | Type of feedback |
| data | JSON | nullable | Feedback data including ratings |
| meta | JSON | nullable | Metadata (arena, chat_id, etc) |
| snapshot | JSON | nullable | Associated chat snapshot |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
File Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier |
| user_id | Text | - | Owner of the file |
| hash | Text | nullable | File hash/checksum |
| filename | Text | - | Name of the file |
| path | Text | nullable | File system path |
| data | JSON | nullable | File-related data |
| meta | JSON | nullable | File metadata |
| access_control | JSON | nullable | Permission settings |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
The meta field's expected structure:
{
"name": text,
"content_type": text,
"size": integer,
}
Folder Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| parent_id | Text | nullable | Parent folder ID for hierarchy |
| user_id | Text | - | Owner of the folder |
| name | Text | - | Folder name |
| items | JSON | nullable | Folder contents |
| meta | JSON | nullable | Folder metadata |
| is_expanded | Boolean | default=False | UI expansion state |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
Things to know about the folder table:
- Folders can be nested (parent_id reference)
- Root folders have null parent_id
- Folder names must be unique within same parent
Function Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier |
| user_id | Text | - | Owner of the function |
| name | Text | - | Function name |
| type | Text | - | Function type |
| content | Text | - | Function content/code |
| meta | JSON | - | Function metadata |
| valves | JSON | - | Function control settings |
| is_active | Boolean | - | Function active status |
| is_global | Boolean | - | Global availability flag |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
Things to know about the folder table:
type can only be: ["filter", "action"]
Group Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY, UNIQUE | Unique identifier (UUID) |
| user_id | Text | - | Group owner/creator |
| name | Text | - | Group name |
| description | Text | - | Group description |
| data | JSON | nullable | Additional group data |
| meta | JSON | nullable | Group metadata |
| permissions | JSON | nullable | Permission configuration |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
Group Membershipβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY, UNIQUE | Unique identifier (UUID) |
| group_id | Text | FOREIGN KEY - group.id | Group identifier |
| user_id | Text | FOREIGN KEY - user.id | User identifier |
| added_at | BigInteger | - | User join timestamp |
Invoiceβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY, UNIQUE | Unique identifier (UUID) |
| user_id | Text | - | User identifier |
| customer_id | Text | - | Third-party payment platform customer ID |
| invoice_id | Text | - | Third-party payment platform invoice ID |
| period_start | BigInteger | - | Billing period start timestamp |
| invoice_issue_date | BigInteger | - | Invoice issuance timestamp |
| created_at | BigInteger | - | Creation timestamp |
| status | Text | NOT NULL | Invoice status |
| invoice_number | Text | - | User-friendly invoice reference number |
| invoice_url | Text | - | URL to download invoice |
| total_amount | Numeric(20,12) | - | Total invoice amount |
| type | Text | NOT NULL | Invoice type |
Things to know about the invoice table:
- One-to-Many relationship with
invoice-items table (shared id)
type value must be one of INVOICE_TYPE (e.g., token or subscription billing)
Invoice Itemβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY, UNIQUE | Unique identifier (UUID) |
| invoice_id | Text | FOREIGN KEY - invoice.id | Invoice identifier |
| amount | Numeric(20,12) | NOT NULL | Invoice item amount |
| data | JSON | NOT NULL | Stores billing-specific metadata |
Things to know about the invoice item table:
- The
data field stores billing-specific metadata and follows structures such as SubscriptionData or PerTokenData.
Knowledge Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY, UNIQUE | Unique identifier (UUID) |
| user_id | Text | - | Knowledge base owner |
| name | Text | - | Knowledge base name |
| description | Text | - | Knowledge base description |
| data | JSON | nullable | Knowledge base content |
| meta | JSON | nullable | Additional metadata |
| access_control | JSON | nullable | Access control rules |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
The access_control fields expected structure:
{
"read": {
"group_ids": ["group_id1", "group_id2"],
"user_ids": ["user_id1", "user_id2"]
},
"write": {
"group_ids": ["group_id1", "group_id2"],
"user_ids": ["user_id1", "user_id2"]
}
}
Memory Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| user_id | Text | - | Memory owner |
| content | Text | - | Memory content |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
Message Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| user_id | Text | - | Message author |
| channel_id | Text | nullable | Associated channel |
| parent_id | Text | nullable | Parent message for threads |
| content | Text | - | Message content |
| data | JSON | nullable | Additional message data |
| meta | JSON | nullable | Message metadata |
| created_at | BigInteger | - | Creation timestamp (nanoseconds) |
| updated_at | BigInteger | - | Last update timestamp (nanoseconds) |
Message Reaction Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier (UUID) |
| user_id | Text | - | User who reacted |
| message_id | Text | - | Associated message |
| name | Text | - | Reaction name/emoji |
| created_at | BigInteger | - | Reaction timestamp |
Model Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Model identifier |
| user_id | Text | - | Model owner |
| base_model_id | Text | nullable | Parent model reference |
| name | Text | - | Display name |
| params | JSON | - | Model parameters |
| meta | JSON | - | Model metadata |
| access_control | JSON | nullable | Access permissions |
| is_active | Boolean | default=True | Active status |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
Things to know about the model table:
- One-to-One relationship with
model catalog table (shared id)
Model Catalogβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Integer | PRIMARY KEY | Model catalog identifier |
| model_id | Text | FOREIGN KEY - model.id | Model identifier |
| details | Text | - | Model details |
| token_limit_per_minute | Integer | - | Maximum allowed tokens per minute |
| model_url | Text | - | URL pointing to the model resource |
| token_tracking | JSON | - | Configuration for token usage tracking |
| is_featured | Boolean | NOT NULL, default=False | Featured model on homepage |
Model Priceβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Model price identifier |
| model_id | Text | FOREIGN KEY - model.id | Model identifier |
| type | Text | | Token type (input/output) |
| valid_from | BigInteger | - | Price validity start timestamp |
| valid_thru | BigInteger | - | Price validity end timestamp |
| created_by | Text | FOREIGN KEY - user.id | Price creator |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
| unit_amount | Numeric(20,12) | - | Model price per unit |
Notification Templateβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Template identifier |
| type | Text | NOT NULL | Template type |
| content | BigInteger | NOT NULL | Template content |
| created_by | Text | FOREIGN KEY - user.id, NOT NULL | Template creator |
| created_at | BigInteger | NOT NULL | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
| updated_by | Text | FOREIGN KEY - user.id | Last modifier |
Subscriptionβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Subscription identifier |
| tier_name | Text | NOT NULL | Subscription Tier name |
| description | Text | - | Tier description |
| billing_period | Text | NOT NULL | Billing period (e.g., monthly or annual) |
| status | Text | NOT NULL | Subscription status |
| created_by | Text | FOREIGN KEY - user.id | Subscription creator |
| created_at | BigInteger | NOT NULL | Creation timestamp |
| updated_at | BigInteger | NOT NULL | Last update timestamp |
| updated_by | Text | FOREIGN KEY - user.id | Last modifier |
Subscription Priceβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Subscription price identifier |
| subscription_id | Text | FOREIGN KEY - subscription.id | Subscription identifier |
| price | Numeric(20,12) | NOT NULL | Tier price |
| included_credits | Numeric(20,12) | NOT NULL | Included credits for subscription |
| valid_from | Text | NOT NULL | Price validity start date |
| valid_thru | Text | - | Price validity end date |
| created_by | Text | FOREIGN KEY - user.id | Price creator |
| created_at | BigInteger | NOT NULL | Creation timestamp |
| updated_at | BigInteger | NOT NULL | Last update timestamp |
| updated_by | Text | FOREIGN KEY - user.id | Last modifier |
Prompt Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| command | Text | PRIMARY KEY | Unique command identifier |
| user_id | Text | - | Prompt owner |
| title | Text | - | Prompt title |
| content | Text | - | Prompt content/template |
| timestamp | BigInteger | - | Last update timestamp |
| access_control | JSON | nullable | Access permissions |
Tag Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PK (composite) | Normalized tag identifier |
| name | Text | - | Display name |
| user_id | Text | PK (composite) | Tag owner |
| meta | JSON | nullable | Tag metadata |
Things to know about the tag table:
- Primary key is composite (id, user_id)
Token Trackingβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | BigInteger | PRIMARY KEY | Token tracking identifier |
| user_id | Text | - | User identifier |
| timestamp | BigInteger | - | Usage recording timestamp |
| prompt_tokens | BigInteger | - | Number of prompt tokens used |
| completion_tokens | BigInteger | - | Number of completion tokens used |
| total_tokens | BigInteger | - | Total tokens consumed |
| model_catalog_id | Integer | FOREIGN KEY - model_catalog.id | Model catalog reference |
| prompt_token_price | Numeric(20,12) | - | Price per prompt token |
| completion_token_price | Numeric(20,12) | - | Price per completion token |
| billing_type | Text | NOT NULL | Billing mode (e.g., subscription or per-token) |
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier |
| user_id | Text | - | Tool owner |
| name | Text | - | Tool name |
| content | Text | - | Tool content/code |
| specs | JSON | - | Tool specifications |
| meta | JSON | - | Tool metadata |
| valves | JSON | - | Tool control settings |
| access_control | JSON | nullable | Access permissions |
| created_at | BigInteger | - | Creation timestamp |
| updated_at | BigInteger | - | Last update timestamp |
User Tableβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier |
| name | Text | - | User's name |
| email | Text | - | User's email |
| role | Text | - | User's role |
| profile_image_url | Text | - | Profile image path |
| last_active_at | BigInteger | - | Last activity timestamp |
| updated_at | BigInteger | - | Last update timestamp |
| created_at | BigInteger | - | Creation timestamp |
| api_key | Text | UNIQUE, nullable | API authentication key |
| settings | JSON | nullable | User preferences |
| info | JSON | nullable | Additional user info |
| oauth_sub | Text | UNIQUE | OAuth subject identifier |
User Agreementβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | BigInteger | PRIMARY KEY | Unique identifier |
| user_id | Text | FOREIGN KEY - user.id | User identifier |
| doc_type | Text | NOT NULL | Document type |
| agreement_id | BigInteger | FOREIGN KEY - agreement.id | Agreement document identifier |
| accepted_at | DateTime | NOT NULL | Agreement acceptance timestamp |
User Payment Statusβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | BigInteger | PRIMARY KEY | Unique identifier |
| user_id | Text | FOREIGN KEY - user.id | User identifier |
| status | Text | - | User payment status |
User Subscriptionβ
| Column Name | Data Type | Constraints | Description |
|---|
| id | Text | PRIMARY KEY | Unique identifier |
| user_id | Text | FOREIGN KEY - user.id | User identifier |
| subscription_id | Text | FOREIGN KEY - subscription.id | Subscription identifier |
| status | Text | NOT NULL | User subscription status |
| credits_remaining | Numeric(20,12) | NOT NULL | Remaining user credits |
| base_credits | Numeric(20,12) | NOT NULL | Base credit allocation |
| start_date | BigInteger | NOT NULL | Subscription start timestamp |
| end_date | BigInteger | NOT NULL | Subscription end timestamp |
| created_at | BigInteger | NOT NULL | Creation timestamp |
| failed_renewal_attempts | BigInteger | NOT NULL | Failed renewal attempts count |
Entity Relationship Diagram
To help visualize the relationship between the tables, refer to the below Entity Relationship Diagram (ERD) generated with Mermaid.