Interface BulkDestroyOptions<TModel>

interface BulkDestroyOptions<TModel> {
    [COMPLETES_TRANSACTION]?: boolean;
    benchmark?: boolean;
    bind?: BindOrReplacements;
    connection?: null | AbstractConnection;
    fieldMap?: FieldMap;
    hardDelete?: boolean;
    instance?: Model<any, any>;
    limit?: number | Nullish | Literal;
    logging?: false | ((sql, timing?) => void);
    manualOnDelete?: ManualOnDelete;
    mapToModel?: boolean;
    nest?: boolean;
    noHooks?: boolean | readonly ("_UNSTABLE_beforeBulkDestroy" | "_UNSTABLE_afterBulkDestroy")[] | {
        except: readonly ("_UNSTABLE_beforeBulkDestroy" | "_UNSTABLE_afterBulkDestroy")[];
    };
    offset?: number | Nullish | Literal;
    plain?: boolean;
    replacements?: BindOrReplacements;
    retry?: Options;
    supportsSearchPath?: boolean;
    transaction?: null | Transaction;
    useMaster?: boolean;
    where: DynamicSqlExpression | {
        [or]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<(DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>>)>>;
    } | {
        [and]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<(DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>>)>>;
    } | {
        [not]: AllowNotOrAndWithImplicitAndArrayRecursive<(DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>>)>;
    } | (DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>> | { [OpTypes.or]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<DynamicSqlExpression | WhereAttributeHash<...>>>; } | { ...; } | { ...; })[] | NonUndefined<WhereAttributeHash<Attributes<TModel>>>;
}

Type Parameters

Hierarchy (view full)

Properties

[COMPLETES_TRANSACTION]?: boolean

Indicates if the query completes the transaction Internal only

benchmark?: boolean

Pass query execution time in milliseconds as second argument to logging function (options.logging).

Either an object of named parameter bindings in the format $param or an array of unnamed values to bind to $1, $2, etc in your SQL.

connection?: null | AbstractConnection

The connection on which this query must be run. Mutually exclusive with Transactionable.transaction.

Can be used to ensure that a query is run on the same connection as a previous query, which is useful when configuring session options.

Specifying this option takes precedence over CLS Transactions. If a transaction is running in the current AsyncLocalStorage context, it will be ignored in favor of the specified connection.

fieldMap?: FieldMap

Map returned fields to arbitrary names for SELECT query type if options.fieldMaps is present.

hardDelete?: boolean

If set to true, paranoid models will actually be deleted instead of soft deleted.

instance?: Model<any, any>

A sequelize instance used to build the return instance

limit?: number | Nullish | Literal
logging?: false | ((sql, timing?) => void)

A function that gets executed while running the query to log the sql.

Type declaration

    • (sql, timing?): void
    • Parameters

      • sql: string
      • Optional timing: number

      Returns void

manualOnDelete?: ManualOnDelete

Manually handles the behavior of ON DELETE in JavaScript, instead of using the native database ON DELETE behavior. This option is useful when:

  • The deletion is a soft deletion.
  • You wish to run JS delete hooks for the cascading models.

Default

'paranoid'
mapToModel?: boolean

Map returned fields to model's fields if options.model or options.instance is present. Mapping will occur before building the model instance.

nest?: boolean

If true, transforms objects with . separated property names into nested objects using dottie.js. For example { 'user.username': 'john' } becomes { user: { username: 'john' }}. When nest is true, the query type is assumed to be 'SELECT', unless otherwise specified

Default

false
noHooks?: boolean | readonly ("_UNSTABLE_beforeBulkDestroy" | "_UNSTABLE_afterBulkDestroy")[] | {
    except: readonly ("_UNSTABLE_beforeBulkDestroy" | "_UNSTABLE_afterBulkDestroy")[];
}

Controls which hooks should be run.

Possible values:

  • false: All hooks will be run. (default)
  • true: No hooks will be run.
  • An array of strings: The hooks listed in the array will not be run.
  • An object with the "except" property: Only the hooks listed in the array will be run.

Type declaration

  • except: readonly ("_UNSTABLE_beforeBulkDestroy" | "_UNSTABLE_afterBulkDestroy")[]
offset?: number | Nullish | Literal
plain?: boolean

Sets the query type to SELECT and return a single row

replacements?: BindOrReplacements
retry?: Options
supportsSearchPath?: boolean

If false do not prepend the query with the search_path (Postgres only)

transaction?: null | Transaction

The transaction in which this query must be run. Mutually exclusive with Transactionable.connection.

If the Sequelize disableClsTransactions option has not been set to true, and a transaction is running in the current AsyncLocalStorage context, that transaction will be used, unless null or another Transaction is manually specified here.

useMaster?: boolean

Force the query to use the write pool, regardless of the query type.

Default

false
where: DynamicSqlExpression | {
    [or]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<(DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>>)>>;
} | {
    [and]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<(DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>>)>>;
} | {
    [not]: AllowNotOrAndWithImplicitAndArrayRecursive<(DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>>)>;
} | (DynamicSqlExpression | WhereAttributeHash<Attributes<TModel>> | { [OpTypes.or]: AllowArray<AllowNotOrAndWithImplicitAndArrayRecursive<DynamicSqlExpression | WhereAttributeHash<...>>>; } | { ...; } | { ...; })[] | NonUndefined<WhereAttributeHash<Attributes<TModel>>>

The WHERE clause. Can be many things from a hash of attributes to raw SQL.

Visit https://sequelize.org/docs/v7/core-concepts/model-querying-basics/ for more information.

Type declaration

Type declaration

Type declaration