This commit is contained in:
2024-11-01 16:09:16 +01:00
parent 1e7f878a64
commit b2429246e4
10 changed files with 234 additions and 0 deletions

26
sql/set_folder_path.sql Normal file
View File

@ -0,0 +1,26 @@
CREATE OR REPLACE PROCEDURE set_folder_path(in_url text) AS $$
DECLARE
temp_folder_path text;
aw_artist_id integer;
aw_website_id integer;
artist_name text;
website_name text;
BEGIN
SELECT aw.artist_id INTO aw_artist_id FROM artist_website aw
WHERE aw.url = in_url;
SELECT aw.website_id INTO aw_website_id FROM artist_website aw
WHERE aw.url = in_url;
SELECT artist.name INTO artist_name FROM artist
WHERE artist.id = aw_artist_id;
SELECT website.name INTO website_name FROM website
WHERE website.id = aw_website_id;
temp_folder_path = concat('Artist/', artist_name, '/', website_name);
UPDATE artist_website SET folder_path = temp_folder_path
WHERE url = in_url;
END;
$$ LANGUAGE plpgsql;