-
-
Notifications
You must be signed in to change notification settings - Fork 617
**Bug: Database Conflict When PraisonAI
Detects Supabase/Postgres in Production Environments**
#335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@claude review this request |
Claude finished @MervinPraison's task —— View job Database Conflict Issue Review✅ Issue Analysis CompleteProblem Validation: The reported issue is VALID and poses significant risks in production environments. 🔍 Root Cause AnalysisAutomatic Database Detection LogicThe current implementation in both # Priority order (hardcoded):
1. SUPABASE_DATABASE_URL (highest priority)
2. DATABASE_URL (fallback)
3. SQLite (only if neither exists) Schema Conflict Points
|
@claude Is there any code change required ? |
Claude finished @MervinPraison's task —— View job Code Change Analysis CompleteYES, code changes are required to fix the database conflict issue described in this issue. Current Problem Analysis:🔍 Database Auto-Detection Logic FoundBoth # db.py:60-63
self.database_url = os.getenv("DATABASE_URL")
supabase_url = os.getenv("SUPABASE_DATABASE_URL")
if supabase_url:
self.database_url = supabase_url
# sql_alchemy.py:37-41
DATABASE_URL = os.getenv("DATABASE_URL")
SUPABASE_DATABASE_URL = os.getenv("SUPABASE_DATABASE_URL")
if SUPABASE_DATABASE_URL:
DATABASE_URL = SUPABASE_DATABASE_URL ❌ Missing FORCE_SQLITE Feature
🚨 Confirmed Risk Factors:
💡 Required Implementation:Immediate Solution - Add FORCE_SQLITE Toggle:# Both db.py and sql_alchemy.py need:
FORCE_SQLITE = os.getenv("FORCE_SQLITE", "false").lower() == "true"
if FORCE_SQLITE:
DATABASE_URL = None
SUPABASE_DATABASE_URL = None Files Requiring Changes:
✅ Conclusion:Code changes are REQUIRED to implement the FORCE_SQLITE feature. This is a critical data safety issue that prevents users from accidentally connecting PraisonAI to production databases. |
@claude implement those changes |
Claude finished @MervinPraison's task —— View job • Implementing FORCE_SQLITE Feature
✅ Implementation CompleteChanges Made:
Usage: export FORCE_SQLITE=true
# Now PraisonAI will use SQLite regardless of DATABASE_URL or SUPABASE_DATABASE_URL Files Modified:
|
…ase detection - Add FORCE_SQLITE flag in both db.py and sql_alchemy.py - When FORCE_SQLITE=true, ignores DATABASE_URL and SUPABASE_DATABASE_URL - Forces SQLite usage to prevent accidental production database connections - Maintains backward compatibility with default behavior (FORCE_SQLITE=false) - Resolves database conflict issues in production environments Fixes #335 Co-authored-by: MervinPraison <[email protected]>
Title:
Bug: Database Conflict When
PraisonAI
Detects Supabase/Postgres in Production EnvironmentsDescription:
Issue:
When using
PraisonAI
in environments where a.env
file includes credentials for Supabase or PostgreSQL (e.g., production setups),PraisonAI
prioritizes these databases over SQLite. This behavior causes schema conflicts, particularly with theusers
table, asPraisonAI
expects a different schema than most production applications.Impact:
.env
or isolating it in a separate environment.Steps to Reproduce:
.env
file with Supabase or PostgreSQL connection strings.PraisonAI
in a project where the database schema conflicts with the tool (e.g., a production app with differentusers
table requirements).Suggested Solution:
A feature was added in [Pull Request #<PR_NUMBER>](<PR_LINK>) to introduce a
FORCE_SQLITE
toggle. This toggle bypasses Supabase/Postgres detection and forces the tool to use SQLite, ensuring isolation from production databases.Workaround:
Before this feature is merged, users can manually:
db.py
file to skip Supabase/Postgres detection and enforce SQLite usage.codePatches
directory of the pull request.Linked Resources:
Request for Maintainers:
Consider merging the feature in Pull Request: #334 and adding documentation for users who might encounter similar issues.
Let me know if there are any additional adjustments you'd like me to make! It is my opinion that this would be well suited for a centralized config file where the user can select whichever database they want used instead of having auto-detect, or in addition to having autodetect.
The text was updated successfully, but these errors were encountered: