Class: OpenC3::PeriodicOnlyDefault

Inherits:
Migration show all
Defined in:
lib/openc3/migrations/20250402000000_periodic_only_default.rb

Class Method Summary collapse

Class Method Details

.runObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/openc3/migrations/20250402000000_periodic_only_default.rb', line 7

def self.run
  ScopeModel.get_all_models(scope: nil).each do |scope, scope_model|
    next if scope == 'DEFAULT'
    model = MicroserviceModel.get_model(name: "#{scope}__SCOPEMULTI__#{scope}", scope: scope)
    if model
      model.cmd.delete("#{scope}__PERIODIC__#{scope}")
      model.update
    end
    model = MicroserviceModel.get_model(name: "#{scope}__PERIODIC__#{scope}", scope: scope)
    model.destroy if model
  end
end