Fix duplicate artist links

INSERT OR REPLACE does not work when null values are provided as part of the unique index
This commit is contained in:
GrégoireDruant 2023-06-13 13:44:23 +02:00
commit 7f11de708f
2 changed files with 9 additions and 2 deletions

View file

@ -402,6 +402,13 @@ update_link = """
INSERT OR REPLACE INTO {LinkType}(actor_id, media_id, media_type)
VALUES (?, ?, ?)
"""
# update_link does not work for actor_link as not all values from unique index are provided
# Resulting in duplicates
insert_link_if_not_exists = """
INSERT INTO {LinkType}(actor_id, media_id, media_type)
SELECT ?, ?, ?
WHERE NOT EXISTS(SELECT 1 FROM {LinkType} WHERE actor_id = ? AND media_id = ? AND media_type = ?)
"""
update_movie = """
UPDATE movie
SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?,