php - How do I add "On Update Cascade" to my existing MySQL tables through PHPmyAdmin? -


so i'm doing work on database many tables, several of have 1 many relationship several other tables. realized i'd made mistake in 1 of parent keys, , updated thinking update in foreign key. confused when didn't. learned have had set "on update cascade" on table (with foreign key?) if wanted automatic updates take place. however, i'm pretty far along database development , i'd not have start tables on add feature tables.

i'm using phpmyadmin pretty everything, , can't seem find button me. need know is: there way can retrofit foreign keys future updates cascade needed?

the following 3 tables examples of tables in database. (this code taken export files)

mysql

create table `icon_stats` (   `id` int(11) not null,   `stat` char(255) collate utf8_bin not null,   `meaning` char(255) collate utf8_bin not null ) engine=innodb auto_increment=6 default charset=utf8 collate=utf8_bin;  create table `icon_values` (   `id` int(11) not null,   `value` char(255) collate utf8_bin not null ) engine=innodb auto_increment=18 default charset=utf8 collate=utf8_bin;  create table `icons_apt` (   `id` int(11) not null,   `species` char(255) collate utf8_bin not null default 'all',   `trait` char(255) collate utf8_bin not null,   `stat` char(255) collate utf8_bin not null,   `value` char(255) collate utf8_bin not null,   `color` char(255) collate utf8_bin not null,   `img` varchar(255) collate utf8_bin not null ) engine=innodb auto_increment=28 default charset=utf8 collate=utf8_bin; 

icons_apt has 4 foreign keys, sake of example i've listed 2: stat icon_stats , value icon_values. i've combed export file icons_apt, can't find stating either of fields have foreign key. i'm not sure how database know relations if export , re-import data.

in case, is there way me update current tables "on update cascade"? or have delete tables, create new 1 , import data again?

you can update tables relations phpmyadmin.

  • go table want update
  • click on "structure" tab
  • then click "relation view"

see screenshot more details :

update table realtions

enter image description here


Comments