Sha256: 02ae54aa626194059a93c78b34f459deb24122e8bd46f67cdff17883baf05b50

Contents?: true

Size: 757 Bytes

Versions: 73

Compression:

Stored size: 757 Bytes

Contents

class AddIndexToDiarySlots < ActiveRecord::Migration[5.1]
  def change
    # Scoped to a diary, the combination of day + station + diurnal_period is unique
    add_index :hd_diary_slots,
              [:diary_id, :station_id, :day_of_week, :diurnal_period_code_id],
              name: :hd_diary_slots_unique_by_station_day_period,
              unique: true,
              where: "deleted_at IS NULL"

    # Scoped to a diary, a patient can only occur once in any combination of day + diurnal_period
    add_index :hd_diary_slots,
              [:diary_id, :day_of_week, :diurnal_period_code_id, :patient_id],
              name: :hd_diary_slots_unique_by_day_period_patient,
              unique: true,
              where: "deleted_at IS NULL"
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
renalware-core-2.0.21 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.20 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.18 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.17 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.16 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.15 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.14 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.13 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.12 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.11 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.9 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.8 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.7 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.5 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.4 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.3 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.2 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.1 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.0 db/migrate/20171016152223_add_index_to_diary_slots.rb
renalware-core-2.0.0.pre.rc13 db/migrate/20171016152223_add_index_to_diary_slots.rb