为什么在尝试将我的模型与mysql数据库(v5.7.19,workbench v6.3.9)同步时会出现这个奇怪的错误?从截图中可以看出,table1_createdOn
甚至没有默认有效,如果我使用sql查询运行生成的命令,它可以工作:
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
CREATE TABLE IF NOT EXISTS `mydb`.`table1` (
`createdOn` TIMESTAMP NOT NULL,
PRIMARY KEY (`createdOn`))
CREATE TABLE IF NOT EXISTS `mydb`.`table2` (
`createdAt` TIMESTAMP NOT NULL,
`table1_createdOn` TIMESTAMP NOT NULL,
PRIMARY KEY (`table1_createdOn`),
CONSTRAINT `fk_round_table1`
FOREIGN KEY (`table1_createdOn`)
REFERENCES `mydb`.`table1` (`createdOn`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)