Когда я редактирую UID в таблице регистрации, столбец parentid в таблице клиентов должен измениться. Это не так. Есть предложения?
Клиенты
CREATE TABLE `clients` (
`id` INT(255) NOT NULL AUTO_INCREMENT,
`fname` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`lname` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`email` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`phone` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`parentid` INT(255) NOT NULL,
`hphone` VARCHAR(12) NOT NULL COLLATE 'latin1_bin',
`postal` VARCHAR(10) NOT NULL COLLATE 'latin1_bin',
`city` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`address` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`province` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`country` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`sms` INT(1) NOT NULL,
`semail` INT(1) NOT NULL,
`gender` VARCHAR(6) NOT NULL COLLATE 'latin1_bin',
`bday` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`bmonth` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
PRIMARY KEY (`id`),
INDEX `parentid` (`parentid`),
CONSTRAINT `FK_clients_signup` FOREIGN KEY (`parentid`) REFERENCES `signup` (`UID`) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE='latin1_bin'
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
AUTO_INCREMENT=31751
Регистрация
CREATE TABLE `signup` (
`UID` INT(255) NOT NULL AUTO_INCREMENT,
`username` VARCHAR(80) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`hash` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`email` VARCHAR(80) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`fname` VARCHAR(40) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`lname` VARCHAR(40) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`address` TEXT NOT NULL COLLATE 'latin1_bin',
`city` VARCHAR(80) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`province` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`zip` VARCHAR(30) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`country` VARCHAR(80) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`company` TEXT NOT NULL COLLATE 'latin1_bin',
`addtime` VARCHAR(20) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`logintime` VARCHAR(20) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`user_ip` VARCHAR(16) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`pwd` VARCHAR(60) NOT NULL DEFAULT '' COLLATE 'latin1_bin',
`credits` INT(255) NOT NULL,
`plan` INT(255) NOT NULL DEFAULT '1',
`reset` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`expires` VARCHAR(255) NOT NULL COLLATE 'latin1_bin',
`afid` INT(255) NOT NULL,
`industryid` INT(255) NOT NULL,
PRIMARY KEY (`UID`),
UNIQUE INDEX `email` (`email`),
UNIQUE INDEX `username` (`username`),
INDEX `industryid` (`industryid`),
INDEX `afid` (`afid`),
INDEX `plan` (`plan`),
CONSTRAINT `FK_signup_affiliates` FOREIGN KEY (`afid`) REFERENCES `affiliates` (`afid`) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT `FK_signup_plans` FOREIGN KEY (`plan`) REFERENCES `plans` (`pid`) ON UPDATE CASCADE ON DELETE CASCADE
)
COLLATE='latin1_bin'
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
AUTO_INCREMENT=27