如何命名sql foreign key constraint on create two tables columns into a relationship table

xn1cxnb4  于 2021-06-17  发布在  Mysql
关注(0)|答案(1)|浏览(369)

我只是想知道是否有一种方法可以命名create表上的外键

FOREIGN KEY (uuid) REFERENCES employee(uuid));

我试图这样做,并命名我的外键为fk1,但我有语法错误

FOREIGN KEY fk1 (uuid) REFERENCES employee(uuid));

错误

org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is com.jda.cloudsql.common.MigrationException: org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException:

  FOREIGN KEY FK1[*] (UUID) REFERENCES EMPLOYEE(UUID)) "; expected "("; SQL statement:
0dxa2lsx

0dxa2lsx1#

你可以写:

ADD CONSTRAINT `customized_foreign_key_name` FOREIGN KEY (`uuid`) REFERENCES `employee` (`uuid`)

相关问题