Thanks for the help. I did it.
I just removed the foreign keys for the updation purpose.
I have done:
alter table customer
drop FOREIGN key fk.customer.bound_sales_channel_id
;
alter table customer
drop FOREIGN key fk.customer.sales_channel_id
;
alter table newsletter_recipient
drop FOREIGN key fk.newsletter_recipient.sales_channel_id
;
ALTER table order
drop FOREIGN key fk.order.sales_channel_id
;
Alter table system_config
drop FOREIGN key fk.system_config.sales_channel_id
;
Then after updating :
ALTER TABLE customer
ADD CONSTRAINT fk.customer.bound_sales_channel_id
FOREIGN KEY (bound_sales_channel_id
)
REFERENCES sales_channel
(id
);
ALTER TABLE customer
ADD CONSTRAINT fk.customer.sales_channel_id
FOREIGN KEY (sales_channel_id
)
REFERENCES sales_channel
(id
);
ALTER TABLE newsletter_recipient
ADD CONSTRAINT fk.newsletter_recipient.sales_channel_id
FOREIGN KEY (sales_channel_id
)
REFERENCES sales_channel
(id
);
ALTER TABLE order
ADD CONSTRAINT fk.order.sales_channel_id
FOREIGN KEY (sales_channel_id
)
REFERENCES sales_channel
(id
);
ALTER TABLE system_config
ADD CONSTRAINT fk.system_config.sales_channel_id
FOREIGN KEY (sales_channel_id
)
REFERENCES sales_channel
(id
);
And I was getting an error with System_config table:
ALTER TABLE system_config
ADD CONSTRAINT fk.system_config.sales_channel_id
FOREIGN KEY (sales_channel_id
)
REFERENCES sales_channel
(id
);
MySQL reports: Documentation
#1452 - Cannot add or update child row: a foreign key condition fails (test
.#sql-5f2_1252a
, CONSTRAINT fk.system_config.sales_channel_id
FOREIGN KEY (sales_channel_id
) REFERENCES sales_channel
(id
))
Static analysis:
1 errors were found during the analysis.
Undetected ALTER operation. (near „;“ at position 81)
SQL command: copy
ALTER TABLE system_config
drop FOREIGN key fk.system_config.sales_channel_id
;
MySQL reports: Documentation
#1064 - Error in SQL syntax. Please look up the correct syntax in the manual at ''fk.system_config.sales_channel_id' in line 1 alter table
system_configdrop FOREIGN key
fk.system_config.sales_channel_id; MySQL reports: Documentation #1091 - DROP FOREIGN KEY: Cannot delete
fk.system_config.sales_channel_id`. Does it exist?
How can i resolve this issue? And when I altered the tables
CONSTRAINT fk.customer.sales_channel_id
FOREIGN KEY (sales_channel_id
) REFERENCES sales_channel
(id
) , the column is updated like this, but i need
CONSTRAINT fk.customer.sales_channel_id
FOREIGN KEY (sales_channel_id
) REFERENCES sales_channel
(id
) ON UPDATE CASCADE . cascade part is not present.
Also for system_config table i need,
CONSTRAINT fk.system_config.sales_channel_id
FOREIGN KEY (sales_channel_id
) REFERENCES sales_channel
(id
) ON DELETE CASCADE ON UPDATE CASCADE , both update and delete cascade.
How i can solve this?