Sha256: d057fe83e87db5c3011a814ac5480624453e95a594ce3e3b4a06ad0fb3fd6ec2

Contents?: true

Size: 619 Bytes

Versions: 6

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

class AddTimestampsToShards < ActiveRecord::Migration[4.2]
  disable_ddl_transaction!

  def change
    add_timestamps :switchman_shards, null: true
    now = Time.now.utc
    Switchman::Shard.update_all(updated_at: now, created_at: now) if Switchman::Shard.current.default?
    change_column_null :switchman_shards, :updated_at, false
    change_column_null :switchman_shards, :created_at, false

    return unless Switchman::Shard.current.default?

    Switchman::Shard.connection.schema_cache.clear!
    Switchman::Shard.reset_column_information
    Switchman::Shard.columns
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
switchman-3.0.5 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-3.0.4 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-3.0.3 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-3.0.2 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-3.0.1 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-3.0.0 db/migrate/20180828192111_add_timestamps_to_shards.rb