fix(db): use DOUBLE PRECISION for position and progress columns
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f061e36092
commit
ea18f18b4f
@@ -21,7 +21,7 @@ CREATE TABLE course_acl (
|
||||
CREATE TABLE progress (
|
||||
user_id TEXT NOT NULL, course_id TEXT NOT NULL, lesson_id TEXT NOT NULL,
|
||||
state TEXT NOT NULL CHECK (state IN ('not-started', 'in-progress', 'done')),
|
||||
position_seconds REAL,
|
||||
position_seconds DOUBLE PRECISION,
|
||||
updated_at TEXT NOT NULL,
|
||||
PRIMARY KEY (user_id, course_id, lesson_id)
|
||||
);
|
||||
@@ -61,7 +61,7 @@ CREATE TABLE collection_courses (
|
||||
PRIMARY KEY (collection_id, course_id)
|
||||
);
|
||||
CREATE TABLE jobs (
|
||||
id TEXT PRIMARY KEY, kind TEXT NOT NULL, status TEXT NOT NULL, progress REAL NOT NULL,
|
||||
id TEXT PRIMARY KEY, kind TEXT NOT NULL, status TEXT NOT NULL, progress DOUBLE PRECISION NOT NULL,
|
||||
message TEXT, payload_json TEXT NOT NULL, result_json TEXT, error TEXT,
|
||||
created_at TEXT NOT NULL, updated_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
@@ -14,7 +14,9 @@ forEachDb("progress upsert keeps one row", async (db) => {
|
||||
expect(got.l1.positionSeconds).toBeNull();
|
||||
expect(got.l2.positionSeconds).toBe(3);
|
||||
expect(typeof got.l1.updatedAt).toBe("string");
|
||||
expect((await db.sql`SELECT COUNT(*) AS n FROM progress WHERE user_id = 'u'`)[0].n.toString()).toBe("2");
|
||||
await p.set("u", "c", "l3", "in-progress", 1234.567);
|
||||
expect((await p.get("u", "c")).l3.positionSeconds).toBe(1234.567);
|
||||
expect((await db.sql`SELECT COUNT(*) AS n FROM progress WHERE user_id = 'u'`)[0].n.toString()).toBe("3");
|
||||
});
|
||||
|
||||
forEachDb("notes order puts slide page 2 before page 10", async (db) => {
|
||||
|
||||
Reference in New Issue
Block a user