Sha256: 291a9ea5ddd0a49fbc17fef717881e4d34603d9d6eb3ebd41c45519acd4d140e

Contents?: true

Size: 520 Bytes

Versions: 16

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

class AddDefaultShardIndex < ActiveRecord::Migration[4.2]
  def change
    Switchman::Shard.where(default: nil).update_all(default: false)
    change_column_default :switchman_shards, :default, false
    change_column_null :switchman_shards, :default, false
    options = if connection.adapter_name == 'PostgreSQL'
                { unique: true, where: "\"default\"" }
              else
                {}
              end
    add_index :switchman_shards, :default, **options
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
switchman-2.2.3 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.2.2 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.2.1 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.2.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.6 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.5 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.4 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.3 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.2 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.1 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.1.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.0.13 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.0.12 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.0.11 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.0.10 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.0.9 db/migrate/20180828183945_add_default_shard_index.rb