Sha256: 8c79598c73a4a711d5f42fba0b8a3adbd89405e2977ca872caed6a8d35fc93df

Contents?: true

Size: 487 Bytes

Versions: 34

Compression:

Stored size: 487 Bytes

Contents

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

34 entries across 34 versions & 1 rubygems

Version Path
switchman-2.0.1 db/migrate/20180828183945_add_default_shard_index.rb
switchman-2.0.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.16.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.15.2 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.15.1 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.15.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.10 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.9 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.8 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.7 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.6 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.5 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.4 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.3 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.2 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.1 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.14.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.13.3 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.13.2 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.13.1 db/migrate/20180828183945_add_default_shard_index.rb