mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Update SQL and remove migration points
This commit is contained in:
parent
53732cdcab
commit
40028e1462
2 changed files with 3 additions and 7 deletions
|
@ -20,6 +20,7 @@ CREATE TABLE public.videos
|
||||||
allowed_regions text[] COLLATE pg_catalog."default",
|
allowed_regions text[] COLLATE pg_catalog."default",
|
||||||
is_family_friendly boolean,
|
is_family_friendly boolean,
|
||||||
genre text COLLATE pg_catalog."default",
|
genre text COLLATE pg_catalog."default",
|
||||||
|
genre_url text COLLATE pg_catalog."default",
|
||||||
CONSTRAINT videos_pkey PRIMARY KEY (id)
|
CONSTRAINT videos_pkey PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
WITH (
|
WITH (
|
||||||
|
|
|
@ -376,13 +376,11 @@ def get_video(id, db, refresh = true)
|
||||||
video = fetch_video(id)
|
video = fetch_video(id)
|
||||||
video_array = video.to_a
|
video_array = video.to_a
|
||||||
|
|
||||||
# MIGRATION POINT
|
|
||||||
video_array = video_array[0..-2]
|
|
||||||
|
|
||||||
args = arg_array(video_array[1..-1], 2)
|
args = arg_array(video_array[1..-1], 2)
|
||||||
|
|
||||||
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,\
|
db.exec("UPDATE videos SET (info,updated,title,views,likes,dislikes,wilson_score,\
|
||||||
published,description,language,author,ucid, allowed_regions, is_family_friendly, genre)\
|
published,description,language,author,ucid, allowed_regions, is_family_friendly,\
|
||||||
|
genre, genre_url)\
|
||||||
= (#{args}) WHERE id = $1", video_array)
|
= (#{args}) WHERE id = $1", video_array)
|
||||||
rescue ex
|
rescue ex
|
||||||
db.exec("DELETE FROM videos * WHERE id = $1", id)
|
db.exec("DELETE FROM videos * WHERE id = $1", id)
|
||||||
|
@ -393,9 +391,6 @@ def get_video(id, db, refresh = true)
|
||||||
video = fetch_video(id)
|
video = fetch_video(id)
|
||||||
video_array = video.to_a
|
video_array = video.to_a
|
||||||
|
|
||||||
# MIGRATION POINT
|
|
||||||
video_array = video_array[0..-2]
|
|
||||||
|
|
||||||
args = arg_array(video_array)
|
args = arg_array(video_array)
|
||||||
|
|
||||||
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
|
db.exec("INSERT INTO videos VALUES (#{args}) ON CONFLICT (id) DO NOTHING", video_array)
|
||||||
|
|
Loading…
Reference in a new issue