Sha256: 9d43d73ac5093475a74e9e0028fcdd8432dbc493f5dcd330448c75dc6678f15a

Contents?: true

Size: 1.09 KB

Versions: 34

Compression:

Stored size: 1.09 KB

Contents

class AddRecurringSync < ActiveRecord::Migration[5.2]
  class FakeSccAccount < ApplicationRecord
    self.table_name = 'scc_accounts'
  end

  def up
    add_column :scc_accounts, :foreman_tasks_recurring_logic_id, :integer
    add_column :scc_accounts, :interval, :string, default: 'never'
    add_column :scc_accounts, :sync_date, :datetime
    add_foreign_key :scc_accounts, :foreman_tasks_recurring_logics, :name => 'scc_accounts_foreman_tasks_recurring_logic_fk', :column => 'foreman_tasks_recurring_logic_id'
    add_column :scc_accounts, :task_group_id, :integer, index: true
    add_foreign_key :scc_accounts, :foreman_tasks_task_groups, column: :task_group_id
    FakeSccAccount.all.each do |scca|
      scca.task_group_id ||= SccAccountSyncPlanTaskGroup.create!.id
      scca.save!
    end
  end

  def down
    remove_column :scc_accounts, :foreman_tasks_recurring_logic_id
    remove_column :scc_accounts, :interval
    remove_column :scc_accounts, :sync_date
    remove_column :scc_accounts, :task_group_id
    ForemanTasks::TaskGroup.where(:type => 'SccAccountSyncPlanTaskGroup').delete_all
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
foreman_scc_manager-4.0.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-3.1.1 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-3.1.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-3.0.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.3.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.2.3 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.2.2 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.2.1 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.2.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.1.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-2.0.0 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.20 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.19 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.18 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.17 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.16 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.15 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.13 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.12 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb
foreman_scc_manager-1.8.10 db/migrate/20190417202427_add_recurring_sync.foreman_scc_manager.rb