首页 > 解决方案 > 传递给 queryInterface.removeConstraint() 的选项对象的属性是什么?

问题描述

queryInterface.removeConstraint()的文档没有记录options可以传递给该removeConstraint()方法的对象。事实上,没有任何options可以传递给各种queryInterface方法的对象被记录在案......

options对象是否记录在任何地方?

版本:

标签: javascriptnode.jssequelize.js

解决方案


是的,文件应该改进。这是一个已确认的问题。如果你使用的是 TypeScript,你可以optionsquery-interface.d.ts文件中找到它的接口。

以下是接口"sequelize": "^5.21.3"

/**
   * Removes constraints from a table
   */
  public removeConstraint(tableName: string, constraintName: string, options?: QueryInterfaceOptions): Promise<void>;
/**
* Most of the methods accept options and use only the logger property of the options. That's why the most used
* interface type for options in a method is separated here as another interface.
*/
export interface QueryInterfaceOptions extends Logging, Transactionable {}
export interface Logging {
  /**
   * A function that gets executed while running the query to log the sql.
   */
  logging?: boolean | ((sql: string, timing?: number) => void);

  /**
   * Pass query execution time in milliseconds as second argument to logging function (options.logging).
   */
  benchmark?: boolean;
}
export interface Transactionable {
  /**
   * Transaction to run query under
   */
  transaction?: Transaction;
}

推荐阅读