DATABASE_URL environment variable.
start.sh and the Docker entrypoint run the Alembic migrations on every start, so tables are created automatically — no manual migration step is required.
SQLite vs PostgreSQL
Known Limitation: SQLite Concurrent Streaming
Connection Pool Configuration
FIM One configures SQLAlchemy connection pool settings internally for each backend. These are tuned defaults that do not require environment variables (the SQLite pool can be resized withSQLITE_POOL_SIZE / SQLITE_MAX_OVERFLOW) — they are applied automatically based on the DATABASE_URL scheme. Understanding them helps explain runtime behavior.
SQLite Pool Settings
WAL mode and the 30-second busy timeout are set via SQLite PRAGMAs on every new connection. This combination ensures that short-lived reads (loading a conversation list, fetching settings) are not blocked by long-running write transactions, and that concurrent writes queue gracefully instead of failing.
PostgreSQL プール設定
PostgreSQL は MVCC を介してネイティブに同時実行性を処理するため、プール設定は主にリソース使用量を制御し、競合ではなく。30分のリサイクル間隔により、ファイアウォール、ロードバランサー、またはアイドル TCP 接続を暗黙的にドロップするマネージドデータベースサービスの問題を回避できます。
PostgreSQLへの切り替え
ステップ 1: PostgreSQL インスタンスを起動する
最も簡単な方法は Docker を使用することです:ステップ 2: DATABASE_URL を設定する
.env ファイルに次の行を追加または更新します:
ステップ 3: FIM One を再起動する
既存の SQLite データは自動的にはマイグレーションされません。
DATABASE_URL を SQLite から PostgreSQL に切り替えると、新しいデータベースから開始されます。SQLite に既存の会話、エージェント、またはコネクタがあり、それらを保持する必要がある場合は、以下のデータマイグレーションセクションを参照してください。Docker Compose (Recommended for Production)
If you deploy with Docker Compose, PostgreSQL and Redis are already included and auto-configured — there is nothing extra to set up. Thedocker-compose.yml sets DATABASE_URL internally — your .env value is overridden:
データ移行
SQLiteからPostgreSQLへの組み込み移行ツールはありません。ほとんどのデプロイメントでは、推奨されるアプローチはあなたの状況によって異なります: 新規デプロイメント(既存データなし):DATABASE_URLをPostgreSQLの接続文字列に設定し、FIM Oneを起動するだけです。すべてのテーブルは自動的に作成されます。
保持する必要がある既存データ: 手動エクスポート/インポートが必要です。一般的なアプローチ:
sqlite3CLIやPythonスクリプトなどのツールを使用してSQLiteからデータをエクスポートする- 必要に応じてデータを変換する(SQLiteとPostgreSQLにはマイナーな型の違いがあります)
psql、pg_restore、またはアプリケーションレベルの挿入スクリプトを使用してPostgreSQLにインポートする