about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--yt/src/storage/migrate/sql/01_zero_to_one.sql3
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;