Sha256: a35f36f976dbcaa675b0dab369120cf501063128cd2cc70601cb796f2b44000f

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

class Phobos03AddCreatedAtToEvents < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
  def up
    add_column :phobos_db_checkpoint_events, :created_at, :datetime

    add_index :phobos_db_checkpoint_events,
      [:event_time],
      name: :phobos_events_event_time_desc_nulls_last_idx,
      order: {event_time: 'desc nulls last'},
      using: :btree

    add_index :phobos_db_checkpoint_events,
      [:created_at],
      name: :phobos_events_created_at_desc_nulls_last_idx,
      order: {created_at: 'desc nulls last'},
      using: :btree

    add_index :phobos_db_checkpoint_failures,
      [:event_time],
      name: :phobos_failures_event_time_desc_nulls_last_idx,
      order: {event_time: 'desc nulls last'},
      using: :btree

    add_index :phobos_db_checkpoint_failures,
      [:created_at],
      name: :phobos_failures_created_at_desc_nulls_last_idx,
      order: {created_at: 'desc nulls last'},
      using: :btree
  end

  def down
    remove_index :phobos_db_checkpoint_events, name: :phobos_events_event_time_desc_nulls_last_idx
    remove_index :phobos_db_checkpoint_events, name: :phobos_events_created_at_desc_nulls_last_idx
    remove_index :phobos_db_checkpoint_failures, name: :phobos_failures_event_time_desc_nulls_last_idx
    remove_index :phobos_db_checkpoint_failures, name: :phobos_failures_created_at_desc_nulls_last_idx

    remove_column :phobos_db_checkpoint_events, :created_at
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
phobos_db_checkpoint-3.4.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-3.3.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-3.2.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-3.1.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-3.0.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-2.4.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-2.3.1 templates/migrate/phobos_03_add_created_at_to_events.rb.erb
phobos_db_checkpoint-2.3.0 templates/migrate/phobos_03_add_created_at_to_events.rb.erb