feat(storage): add SQLiteTaskStorage backend with CRUD and pagination#55
feat(storage): add SQLiteTaskStorage backend with CRUD and pagination#55premchand11 wants to merge 1 commit intoTheDevOpsBlueprint:mainfrom
Conversation
|
@premchand11 Awesome job!! There are just 3 things that I think can make this PR perfect No CLI integration - The SQLite backend exists but nothing uses it Can you fix those , thanks ! |
919a6cd to
b6e7712
Compare
|
hi @Valentin-v-Todorov To prevent CLI crashes (e.g., when running tix add or tix ls), try:
from tix.storage.context_storage import ContextStorage
except ModuleNotFoundError:
class ContextStorage:
"""Stub ContextStorage if missing (keeps CLI functional)"""
def set_active_context(self, name): pass
def get_active_context(self): return NoneThis ensures backward compatibility and prevents ModuleNotFoundError |
|
Hey @premchand11 , thanks for the work on this! I reviewed the PR and found some critical issues that need fixing before we can merge. The main problem is that the SQLite implementation is missing support for attachments and links fields that exist in our current JSON storage. This will cause data loss for users who have files or URLs attached to their tasks. In tix/storage/sqlite_storage.py line 15-24, you need to add attachments TEXT and links TEXT columns to the CREATE TABLE statement. In tix/models.py, both to_row() (lines 48-53) and from_row() (lines 55-67) need to include the attachments and links fields. For to_row(), add ",".join(self.attachments) and ",".join(self.links) to the return tuple. For from_row(), add attachments=row["attachments"].split(",") if row["attachments"] else [] and links=row["links"].split(",") if row["links"] else [] to the return statement. The SQLiteTaskStorage class also needs to support undo/redo functionality. Add history: HistoryManager = None parameter to init (line 10), import HistoryManager at the top, and call self.history.record() in add_task, update_task, and delete_task methods with record_history: bool = True parameters, just like the JSON storage does. You're also missing a save_tasks() method that the CLI uses in several commands like clear and move. Add this method to bulk save tasks. The ContextStorage stub is fine as a temporary solution. Once you fix these issues, we'll be good to merge! ✌️ |
PR Checklist
What does this PR do?
This PR introduces a new SQLite-based storage backend for TIX.
Key changes
to_row()andfrom_row()helpers to mapTaskobjects to SQLite rows.SQLiteTaskStorageclass with:list_tasks(page, page_size)iter_tasks(start, count)Related Issue
Closes #20 (SQLite backend implementation)
Type of change