ALTER TABLE docs ADD id_workshop int(10) unsigned DEFAULT NULL AFTER id_user;
ALTER TABLE docs ADD INDEX(`id_workshop`);
ALTER TABLE docs ADD FOREIGN KEY (`id_workshop`) REFERENCES workshops(`id_workshop`);
UPDATE docs INNER JOIN courses USING(id_course) SET docs.id_workshop = courses.id_workshop;
ALTER TABLE docs DROP FOREIGN KEY docs_ibfk_2;
ALTER TABLE docs DROP id_course;