feat(counters): Add details and initial refactor.

This commit is contained in:
2024-09-27 00:36:12 +10:00
parent 9c9107bf9d
commit 8f6fdf3381
4 changed files with 86 additions and 59 deletions

View File

@@ -10,7 +10,8 @@ class CounterData(Registry):
CREATE TABLE counters(
counterid SERIAL PRIMARY KEY,
name TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
category TEXT
);
CREATE UNIQUE INDEX counters_name ON counters (name);
"""
@@ -19,6 +20,7 @@ class CounterData(Registry):
counterid = Integer(primary=True)
name = String()
category = String()
created_at = Timestamp()
class CounterEntry(RowModel):
@@ -31,7 +33,8 @@ class CounterData(Registry):
userid INTEGER NOT NULL,
value INTEGER NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
context_str TEXT
context_str TEXT,
details TEXT
);
CREATE INDEX counter_log_counterid ON counter_log (counterid);
"""
@@ -44,5 +47,5 @@ class CounterData(Registry):
value = Integer()
created_at = Timestamp()
context_str = String()
details = String()