Sha256: 2f87e3efe79405e70efdb10c250b2ad7fcfdc9af0f61b33ff400f98381c00006

Contents?: true

Size: 1.52 KB

Versions: 10

Compression:

Stored size: 1.52 KB

Contents

class DropRunStartMinuteFromApplicationSchedules < ActiveRecord::Migration
  def up
    execute <<-SQL
			ALTER TABLE #{Naf.schema_name}.application_schedules DROP COLUMN run_start_minute;
			ALTER TABLE #{Naf.schema_name}.application_schedules ALTER COLUMN run_interval SET NOT NULL;
			ALTER TABLE #{Naf.schema_name}.application_schedules ALTER COLUMN run_interval_style_id SET NOT NULL;

      INSERT INTO #{Naf.schema_name}.application_schedules (application_id, application_run_group_restriction_id,
        application_run_group_name, application_run_group_limit, run_interval, run_interval_style_id) VALUES
        (
          (SELECT id FROM #{Naf.schema_name}.applications where command = '::Process::Naf::Janitor.run'),
          (SELECT id FROM #{Naf.schema_name}.application_run_group_restrictions
            WHERE application_run_group_restriction_name = 'limited per all machines'),
          '::Process::Naf::Janitor.run',
          1,
          5,
          1
        );
    SQL
  end

  def down
    execute <<-SQL
      ALTER TABLE #{Naf.schema_name}.application_schedules ADD COLUMN run_start_minute INTEGER NULL
      	CHECK (run_start_minute >= 0 and run_start_minute < (24 * 60));
			ALTER TABLE #{Naf.schema_name}.application_schedules ALTER COLUMN run_interval DROP NOT NULL;
			ALTER TABLE #{Naf.schema_name}.application_schedules ALTER COLUMN run_interval_style_id DROP NOT NULL;

      DELETE FROM #{Naf.schema_name}.application_schedules
        WHERE application_run_group_name = '::Process::Naf::Janitor.run';
    SQL
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
naf-2.1.13 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.12 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.11 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.10 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.9 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.8 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.6 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.5 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.4 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb
naf-2.1.3 db/migrate/20140113183243_drop_run_start_minute_from_application_schedules.rb