mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 03:06:28 +08:00
13 lines
344 B
Ruby
13 lines
344 B
Ruby
class ResetAssignedSamplesCounters < ActiveRecord::Migration[4.2]
|
|
def change
|
|
if defined?(Sample)
|
|
Sample.find_each do |sample|
|
|
Sample.reset_counters(sample.id, :sample_my_modules)
|
|
end
|
|
|
|
MyModule.find_each do |my_module|
|
|
MyModule.reset_counters(my_module.id, :sample_my_modules)
|
|
end
|
|
end
|
|
end
|
|
end
|