16 lines
432 B
SQL
16 lines
432 B
SQL
CREATE TABLE `vn`.`device` (
|
|
`id` INT NOT NULL,
|
|
`sn` VARCHAR(50) NULL,
|
|
`model` VARCHAR(50) NULL,
|
|
`userFk` INT(10) UNSIGNED NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
INDEX `device_fk1_idx` (`userFk` ASC),
|
|
CONSTRAINT `device_fk1`
|
|
FOREIGN KEY (`userFk`)
|
|
REFERENCES `account`.`user` (`id`)
|
|
ON DELETE NO ACTION
|
|
ON UPDATE NO ACTION);
|
|
|
|
ALTER TABLE `vn`.`device`
|
|
CHANGE COLUMN `id` `id` INT(11) NOT NULL AUTO_INCREMENT ;
|