如何命名 SQL FOREIGN KEY Constraint on CREATE two tables columns into a relationship TABLE

How to name SQL FOREIGN KEY Constraint on CREATE two tables columns into a relationship TABLE

我只是想知道是否有办法在创建时命名外键 table

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:

你可以这样写:

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