mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-18 03:36:35 -07:00
fix: release associations and add cleanup migration
This commit is contained in:
parent
16cee8cfca
commit
2b4dca78e3
8 changed files with 95 additions and 15 deletions
9
db/migrations/000005_rm_orphan_artist_releases.sql
Normal file
9
db/migrations/000005_rm_orphan_artist_releases.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- +goose Up
|
||||
DELETE FROM artist_releases ar
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM artist_tracks at
|
||||
JOIN tracks t ON at.track_id = t.id
|
||||
WHERE at.artist_id = ar.artist_id
|
||||
AND t.release_id = ar.release_id
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue