13 lines
532 B
SQL
13 lines
532 B
SQL
-- Drop the old foreign key constraint that links tasks to candidates.
|
|
-- The name 'tasks_ibfk_1' is the default name generated by MySQL.
|
|
ALTER TABLE `tasks` DROP FOREIGN KEY `tasks_ibfk_1`;
|
|
|
|
-- Drop the old column linking to candidates.
|
|
ALTER TABLE `tasks` DROP COLUMN `candidate_id`;
|
|
|
|
-- Add the new column to link tasks to employees (users).
|
|
ALTER TABLE `tasks` ADD COLUMN `assignee_id` INT;
|
|
|
|
-- Add the new foreign key constraint.
|
|
ALTER TABLE `tasks` ADD FOREIGN KEY (`assignee_id`) REFERENCES `users`(`id`) ON DELETE SET NULL;
|