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-1.13.0 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.16 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.15 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.14 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.13 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.12 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.11 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.10 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.9 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.8 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.7 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.6 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.5 db/migrate/20180828183945_add_default_shard_index.rb
switchman-1.12.4 db/migrate/20180828183945_add_default_shard_index.rb