database: change reading_speed columns from DECIMAL to REAL
- Changed words_per_minute, pages_per_minute, total_reading_minutes from DECIMAL(6,2) / DECIMAL(8,2) to REAL - REAL (pgtype.Float4) is sufficient for reading statistics and simplifies Go code - No precision loss for typical reading speed values (200-400 wpm, 0.5-3.0 pages/min)
This commit is contained in:
@@ -1174,10 +1174,10 @@ CREATE TABLE IF NOT EXISTS reading_speed (
|
|||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||||
media_item_id UUID NOT NULL REFERENCES media_items(id) ON DELETE CASCADE,
|
media_item_id UUID NOT NULL REFERENCES media_items(id) ON DELETE CASCADE,
|
||||||
words_per_minute DECIMAL(6,2),
|
words_per_minute REAL,
|
||||||
pages_per_minute DECIMAL(6,2),
|
pages_per_minute REAL,
|
||||||
pages_read INTEGER DEFAULT 0,
|
pages_read INTEGER DEFAULT 0,
|
||||||
total_reading_minutes DECIMAL(8,2) DEFAULT 0,
|
total_reading_minutes REAL DEFAULT 0,
|
||||||
last_read_at TIMESTAMPTZ DEFAULT NOW(),
|
last_read_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
updated_at TIMESTAMPTZ DEFAULT NOW(),
|
||||||
UNIQUE(user_id, media_item_id)
|
UNIQUE(user_id, media_item_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user