0

For example, I have table task which has three fields, id, title and user.

I have added a new field, taskId, using ALTER TABLE task ADD COLUMN taskId INT NOT NULL AFTER id;

Now column name id from task table is used as a foreign key reference in many tables.

Second table, taskMisc, has two columns, taskId and isStarred,
and taskId is using reference as id from task table. It's like that for many tables.

How can I change all references at once?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
DEV
  • 455
  • 4
  • 18
  • Take a look at [this](https://stackoverflow.com/questions/3359329/how-to-change-the-foreign-key-referential-action-behavior) – sajjad rezaei Jan 14 '22 at 12:28
  • selectting al tables from information schema and running a loop that changes will take more time than making that manually as you only need to do it once – nbk Jan 14 '22 at 12:29

0 Answers0