refactor: Simplify SQL

This commit is contained in:
Ahmad Ansori Palembani 2024-08-10 11:30:42 +07:00
parent 7e1b532f83
commit e1ccfeeb0a
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -14,10 +14,9 @@ SELECT S.* FROM (
) AS S;
-- Replace seperator from ' & ' to less common ' [.] '
WITH tmp(_id, filtered_scanlators) AS (SELECT _id, replace(filtered_scanlators, ' & ', ' [.] ') FROM mangas)
UPDATE mangas
SET filtered_scanlators = (SELECT filtered_scanlators FROM tmp)
WHERE _id IN (SELECT _id FROM tmp);
SET filtered_scanlators = replace(filtered_scanlators, ' & ', ' [.] ')
WHERE filtered_scanlators IS NOT NULL;
-- To sync the project
DROP VIEW IF EXISTS library_view;