feat(core): add SQLite in-memory database support#568
Draft
Conversation
- Add SQLite schema (prisma-sqlite/schema.prisma) as alternative to PostgreSQL/MongoDB - Update database/config.js to detect SQLite and fallback when no database configured - Update database/prisma.js to load SQLite client with auto-created .frigg/frigg.db - Update handlers/database-migration-handler.js to support SQLite schema path - Add npm scripts for SQLite prisma:generate and prisma:push - Add tests for SQLite ensureSqliteDirectory() function Benefits: - AI agents can now run Frigg without database setup - Zero-config local development experience - Data persists across restarts (.frigg/frigg.db) - All tables sync automatically on first connection
- Add SQLite repository classes for all database models: - Credential, Token, User, Integration - IntegrationMapping, Process, Module - WebsocketConnection, Sync, HealthCheck - SQLite repositories extend PostgreSQL repositories since they share: - Int IDs with autoincrement - JSON stored as String - Update all factory functions to support 'sqlite' database type - Add basic tests for SQLite repositories
Bug fixes: - Add _convertIntegrationIds to properly combine separate message fields (errors, warnings, info, logs) into a messages object - Fix updateIntegrationMessages to read from correct message field instead of non-existent 'messages' field - Fix findIntegrationByName to work with PostgreSQL (was using MongoDB JSON path syntax) - Implement lazy initialization for tokenRepository in UserRepository to avoid circular dependency at module load time The SQLite repository inherits these fixes since it extends PostgreSQL.
Critical fixes: - Update updateIntegrationMessages to serialize array to JSON string for SQLite (which uses String fields instead of Json) - Add config import to integration-repository-postgres.js - Update JSDoc @returns type to include 'sqlite' SQLite stores message fields as String, so we must JSON.stringify() the array before writing. PostgreSQL accepts arrays directly.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Add SQLite as a zero-config database option for Frigg, enabling AI agents to run Frigg without any database setup.
Changes
Benefits
Usage
Testing
Verified working:
Built with Pi and MiniMax-M2.7