Sha256: ba16c7e40156a676a90d0993099fbab3af0aaaee010444f770f8fe686fe47b70

Contents?: true

Size: 593 Bytes

Versions: 22

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

class AddTimestampsToShards < ActiveRecord::Migration[4.2]
  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

    if Switchman::Shard.current.default?
      Switchman::Shard.connection.schema_cache.clear!
      Switchman::Shard.reset_column_information
      Switchman::Shard.columns
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
switchman-2.2.3 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.2.2 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.2.1 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.2.0 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.6 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.5 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.4 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.3 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.2 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.1 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.1.0 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.13 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.12 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.11 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.10 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.9 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.8 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.7 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.6 db/migrate/20180828192111_add_timestamps_to_shards.rb
switchman-2.0.5 db/migrate/20180828192111_add_timestamps_to_shards.rb