mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 17:05:56 +03:00
[PR #414] [MERGED] Standardize tenant workspace DB directory to db/ with legacy migration support #717
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#717
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/414
Author: @AJaySi
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @AJaySi
Base:
main← Head:codex/refactor-database-directory-for-workspaces📝 Commits (1)
7557febStandardize tenant DB directory to db with legacy migration📊 Changes
8 files changed (+87 additions, -44 deletions)
View changed files
📝
backend/check_cols.py(+5 -2)📝
backend/scripts/debug_usage_v2.py(+2 -12)📝
backend/scripts/inspect_user_db.py(+6 -5)📝
backend/scripts/verify_db_path.py(+5 -13)📝
backend/services/database.py(+51 -4)📝
backend/services/research/deep_crawl_service.py(+1 -1)📝
backend/services/user_workspace_manager.py(+12 -5)📝
backend/verify_schema.py(+5 -2)📄 Description
Motivation
database/for new user workspaces and makedb/the single canonical tenant DB directory.services/database.pyis the single source of truth for DB locations.database/layouts during rollout.Description
ensure_user_workspace_db_directory(user_id)and_sanitize_user_idinservices/database.pyto create/ensureworkspace/workspace_<id>/db/and migrate a legacydatabase/directory via rename or hard-link/copy fallback.get_user_db_pathto call the new ensure function, prefer files underdb/, and continue to resolve legacy files if migration has not yet occurred.UserWorkspaceManagerto stop provisioning adatabase/folder and delegate DB-directory setup toservices.databaseby callingensure_user_workspace_db_directorybefore creating other subdirectories.backend/scripts/*,backend/check_cols.py,backend/verify_schema.py) to derive DB paths viaget_user_db_pathinstead of custom path logic and corrected an outdated comment indeep_crawl_service.pyto reference thedb/location.Testing
python -m compileallfor the modified files, which completed successfully.WORKSPACE_DIRto a temp directory and creating aworkspace_<id>/database/containing an old DB file, then calledget_user_db_pathwhich triggered migration and returned the expected canonicaldb/path (migration and resolution verified).PYTHONPATH=backendimport-based smoke run to ensure the new helpers are reachable and that existing scripts usingget_user_db_pathwork as expected and reported success.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.