Sha256: f62b063c48e4f1d16e3fabb9c4053364aa621ad2547d2044150edc08a45918f3
Contents?: true
Size: 555 Bytes
Versions: 32
Compression:
Stored size: 555 Bytes
Contents
# frozen_string_literal: true class AddDefaultShardIndex < ActiveRecord::Migration[4.2] def change Switchman::Shard.where(default: nil).update_all(default: false) if Switchman::Shard.current.default? 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
32 entries across 32 versions & 1 rubygems