feat: Migration v0 to v1.

Move 'tasklist' table to 'taskslist' for compatibility.
Add migration sql script.
Add 'taskslist_info' view.
Add 'completed_in' to tasks.
This commit is contained in:
2025-10-02 20:32:00 +10:00
parent daf72be82e
commit 48eda11e1d
5 changed files with 151 additions and 14 deletions

12
data.py
View File

@@ -9,7 +9,7 @@ class Task(RowModel):
Schema
------
"""
_tablename_ = 'tasklist'
_tablename_ = 'taskslist'
_cache_ = {}
taskid = Integer(primary=True)
@@ -20,6 +20,7 @@ class Task(RowModel):
duration = Integer()
started_at = Timestamp()
completed_at = Timestamp()
completed_in = Integer()
_timestamp = Timestamp()
@@ -32,10 +33,12 @@ class TaskProfile(RowModel):
_cache_ = {}
profileid = Integer(primary=True)
show_tips = Bool()
show_encouragement = Bool()
class TaskInfo(RowModel):
_tablename_ = 'tasklist_info'
_tablename_ = 'taskslist_info'
taskid = Integer(primary=True)
profileid = Integer()
@@ -44,14 +47,17 @@ class TaskInfo(RowModel):
duration = Integer()
started_at = Timestamp()
completed_at = Timestamp()
completed_in = Integer()
last_started = Timestamp()
nowid = Integer()
order_idx = Integer()
is_running = Bool()
is_planned = Bool()
is_complete = Bool()
show_tips = Bool()
show_encouragement = Bool()
tasklabel = Integer()
@property