Module: Sequel::Plugins::SingleStatementDatasetDestroy
- Defined in:
- lib/sequel/plugins/single_statement_dataset_destroy.rb
Overview
The single_statement_dataset_destroy plugin makes the model dataset.destroy method delete all rows in a single DELETE statement. It runs all before_destroy hooks before the DELETE, and all after_destroy hooks after the delete.
This is not compatible with around_destroy hooks, so if the model is using custom around_destroy hooks, dataset.destroy falls back to a separate DELETE statement per row.
Usage:
# Make all model subclasses use a single DELETE
# statement for dataset.destroy
Sequel::Model.plugin :single_statement_dataset_destroy
# Make the Album class use a single DELETE
# statement for dataset.destroy
Album.plugin :single_statement_dataset_destroy
Defined Under Namespace
Modules: DatasetMethods