0
I wonder if there is a way to clear the user_id/store_id reference present in the table
user_store
CREATE TABLE IF NOT EXISTS `user`(
`id` INT(11) PRIMARY KEY AUTO_INCREMENT)
CREATE TABLE IF NOT EXISTS `store`(
`id` INT(11) PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL UNIQUE
)ENGINE INNODB DEFAULT CHAR SET 'utf8' AUTO_INCREMENT=10;
CREATE TABLE IF NOT EXISTS `user_store`(
`id` INT(11) PRIMARY KEY AUTO_INCREMENT,
`user_id` INT(11) NOT NULL,
`store_id` INT(11) NOT NULL,
CONSTRAINT `fk_user_id`
FOREIGN KEY (`user_id`)
REFERENCES `user`(`id`),
CONSTRAINT `fk_store_id`
FOREIGN KEY (`store_id`)
REFERENCES `store`(`id`)
)ENGINE INNODB DEFAULT CHAR SET 'utf8' AUTO_INCREMENT=10;
You refer to removing the constraints fk_user_id and fk_store_id or just removing the data (values) from the referenced tables?
– Juven_v
For example if the user removes his store, user_store should have the normal id and user_id, store_id would be reset
– La Treta