[config/config.example.yml]
- Separate hide_shorts_and_live to hide_shorts and hide_livestreams
[config/sql/channel_videos.sql]
- Introduce enum video_type
- Include video_type as new column for channel_videos
[locales/en-US.json]
- Add labels for new settings
[src/invidious/channels/channels.cr]
- Add property video_type of type VideoType to ChannelVideo struct
- Add deserializer module for conversion from database entry to enum
- Add check if we already have a video in the database.
If the video `updated` field has no been updated, only update views
- Add check whether a video is in the `videos` array. If this is not
the case, fetch the individual video for `video_type` as well as
`length_videos`
[src/invidious/config.cr]
- Separate hide_shorts_and_live property
to hide_shorts and hide_livestreams properties
[src/invidious/database/channels.cr]
- Include video_type in database insert for ChannelVideo
[src/invidious/routes/preferences.cr]
- Separate hide_shorts_and_live setting to hide_shorts and hide_livestreams
[src/invidious/users.cr]
- Accumulate VideoTypes in an array and query on these types
- Remove paths for hide_shorts_and_live
[src/invidious/videos.cr]
- Add `Short` entry to VideoType enum
[src/invidious/videos/parser.cr]
- Add check whether a video is a short
Unlike the other migrations, this one uses a bare table name to specify the table. This means it looks in the default search path. Unfortunately, the out of box search path is:
1. Schema with the same name as the user
2. Public
Because of this, if a schema exists with the same name as the DB user, the playlist_videos table will get created in _that_ schema, rather than the public schema, and then the grant statement will fail with an error like below if check_table is enabled as it keeps trying to create the table but failing on the grant statement:
```
2022-01-22 02:27:42 UTC [info] check_table: check_table: CREATE TABLE playlist_videos
Unhandled exception: relation "public.playlist_videos" does not exist (PQ::PQError)
from /usr/share/crystal/src/primitives.cr:266:3 in 'handle_error'
from lib/pg/src/pq/connection.cr:184:9 in 'handle_async_frames'
from lib/pg/src/pq/connection.cr:162:7 in 'read'
from lib/pg/src/pq/query.cr:53:14 in 'exec_all'
from lib/db/src/db/database.cr:126:9 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:110:5 in 'main'
from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
2022-01-22 02:27:43 UTC [info] check_table: check_table: CREATE TABLE playlist_videos
Unhandled exception: relation "public.playlist_videos" does not exist (PQ::PQError)
from /usr/share/crystal/src/primitives.cr:266:3 in 'handle_error'
from lib/pg/src/pq/connection.cr:184:9 in 'handle_async_frames'
from lib/pg/src/pq/connection.cr:162:7 in 'read'
from lib/pg/src/pq/query.cr:53:14 in 'exec_all'
from lib/db/src/db/database.cr:126:9 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:110:5 in 'main'
from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
```