mirror of
https://github.com/sphildreth/roadie
synced 2024-11-28 15:10:38 +00:00
13 lines
No EOL
290 B
SQL
13 lines
No EOL
290 B
SQL
UPDATE `track`
|
|
set artistId = NULL
|
|
where id in (select t.id
|
|
from `track` t
|
|
where artistId IS NOT NULL
|
|
and artistId NOT IN (select id from `artist`));
|
|
|
|
ALTER TABLE `track`
|
|
ADD CONSTRAINT `track_artist_ibfk_1`
|
|
FOREIGN KEY (`artistId`)
|
|
REFERENCES `artist` (`id`)
|
|
ON DELETE SET NULL;
|
|
|