lib/tasks/statesman.rake in statesman-1.3.0 vs lib/tasks/statesman.rake in statesman-1.3.1
- old
+ new
@@ -13,10 +13,10 @@
done_models = 0
batch_size = 500
parent_class.find_in_batches(batch_size: batch_size) do |models|
ActiveRecord::Base.transaction do
- if transition_class.columns_hash['most_recent'].null == false
+ if Statesman::Adapters::ActiveRecord.database_supports_partial_indexes?
# Set all transitions' most_recent to FALSE
transition_class.where(parent_fk => models.map(&:id)).
update_all(most_recent: false)
else
transition_class.where(parent_fk => models.map(&:id)).