sequelize:如何创建约束名称

时间:2019-11-11 04:51:32

标签: sequelize.js

我在以下行中有一个SQL查询

CONSTRAINT `some_key_1` FOREIGN KEY (`another_table_uuid`) REFERENCES `another_table` (`uuid`),
  CONSTRAINT `some_key_2` FOREIGN KEY (`another_table_uuid`) REFERENCES `another_table` (`uuid`)

我像这样在续集中创建了一个关联:

current_table.associate = models => {

    current_table.belongsTo(models.another_table, {
        foreignKey: "another_table_uuid",
        targetKey: "uuid",
    });
    current_table.belongsTo(models.another_table, {
        foreignKey: "another_table_uuid",
        targetKey: "uuid",
    });

});

但是如何在此处添加约束名称

也是mysql中的这一行:

密钥somekey_name_UUIDsome_table_uuid

如何将其更改为续集。

0 个答案:

没有答案