diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-02-22 11:38:08 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-02-22 11:38:08 +0100 |
commit | 62cdd76443bbecfbdb70a82a7936a2e602338692 (patch) | |
tree | 0035e14c39508cb5f47f24ee966837656029d21e | |
parent | fix(yt/storage/migrate): Improve error reporting (diff) | |
download | yt-62cdd76443bbecfbdb70a82a7936a2e602338692.zip |
fix(yt/storage/migrate/sql/01_zero_to_one.sql): Account for duration being NULL
-rw-r--r-- | yt/src/storage/migrate/sql/01_zero_to_one.sql | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/yt/src/storage/migrate/sql/01_zero_to_one.sql b/yt/src/storage/migrate/sql/01_zero_to_one.sql index 42c3b02..d33eb05 100644 --- a/yt/src/storage/migrate/sql/01_zero_to_one.sql +++ b/yt/src/storage/migrate/sql/01_zero_to_one.sql @@ -11,9 +11,8 @@ UPDATE videos SET is_focused = 0; -- The progress the user made in watching the video. ALTER TABLE videos ADD watch_progress INTEGER NOT NULL DEFAULT 0 CHECK (watch_progress <= duration); - -- Assume, that the user has watched the video to end, if it is marked as watched -UPDATE videos SET watch_progress = duration WHERE status = 3; +UPDATE videos SET watch_progress = ifnull(duration, 0) WHERE status = 3; UPDATE videos SET watch_progress = 0 WHERE status != 3; ALTER TABLE videos DROP COLUMN status_change; |