CREATE TABLE `vn`.`userPhone` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `userFk` INT(10) UNSIGNED NOT NULL,
  `typeFk` VARCHAR(45) NOT NULL,
  `phone` VARCHAR(15) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `UserFK_Phone` (`userFk` ASC, `phone` ASC));


ALTER TABLE `vn`.`userPhone` 
ADD CONSTRAINT `fgnTypeFk`
  FOREIGN KEY (typeFk)
  REFERENCES `vn`.`userPhoneType` (code)
  ON DELETE RESTRICT
  ON UPDATE CASCADE;

ALTER TABLE `vn`.`userPhone` 
ADD CONSTRAINT `fgnUserFk`
  FOREIGN KEY (userFk)
  REFERENCES `account`.`user` (id)
  ON DELETE CASCADE
  ON UPDATE CASCADE;
  
