Sha256: 53f457b7324c15cfd97ccaff3bc68d611c7bb16791df671daa3292158305a2cb

Contents?: true

Size: 570 Bytes

Versions: 74

Compression:

Stored size: 570 Bytes

Contents

class CreateHospitalWards < ActiveRecord::Migration[5.1]
  def change
    create_table :hospital_wards do |t|
      t.string :name, null: false
      t.references :hospital_unit, index: true, foreign_key: true, null: false
      t.datetime :deleted_at
      t.timestamps null: false
    end

    # This create a postgres partial index
    # Name must be unique in for any unit, but only amongst un-deleted wards.
    add_index :hospital_wards,
              [:name, :hospital_unit_id],
              unique: true,
              where: "deleted_at IS NOT NULL"
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
renalware-core-2.0.64 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.63 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.62 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.61 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.60 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.58 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.57 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.56 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.55 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.54 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.53 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.52 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.51 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.50 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.48 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.47 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.46 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.45 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.44 db/migrate/20171003093347_create_hospital_wards.rb
renalware-core-2.0.43 db/migrate/20171003093347_create_hospital_wards.rb