Sha256: 3e4be6f20448043f0d24f17fb4eb3061d8ac243c0068e1fb9e8c347f6502df14

Contents?: true

Size: 1.41 KB

Versions: 177

Compression:

Stored size: 1.41 KB

Contents

class CreateHDPatientStatistics < ActiveRecord::Migration[4.2]
  def change
    create_table :hd_patient_statistics do |t|
      t.belongs_to :patient, null: false, index: true, foreign_key: true
      t.belongs_to :hospital_unit, index: true, null: false, foreign_key: true

      t.integer :month, index: true
      t.integer :year, index: true
      t.boolean :rolling, index: true

      t.decimal :pre_mean_systolic_blood_pressure, precision: 10, scale: 2
      t.decimal :pre_mean_diastolic_blood_pressure, precision: 10, scale: 2
      t.decimal :post_mean_systolic_blood_pressure, precision: 10, scale: 2
      t.decimal :post_mean_diastolic_blood_pressure, precision: 10, scale: 2
      t.decimal :lowest_systolic_blood_pressure, precision: 10, scale: 2
      t.decimal :highest_systolic_blood_pressure, precision: 10, scale: 2
      t.decimal :mean_fluid_removal, precision: 10, scale: 2
      t.decimal :mean_weight_loss, precision: 10, scale: 2
      t.decimal :mean_machine_ktv, precision: 10, scale: 2
      t.decimal :mean_blood_flow, precision: 10, scale: 2
      t.decimal :mean_litres_processed, precision: 10, scale: 2

      t.timestamps null: false
    end

    # A patient can only have one row per month
    add_index :hd_patient_statistics, [:patient_id, :month, :year], unique: true

    # A patient can only have one rolling row
    add_index :hd_patient_statistics, [:patient_id, :rolling], unique: true
  end
end

Version data entries

177 entries across 177 versions & 1 rubygems

Version Path
renalware-core-2.1.1 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.1.0 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.167 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.166 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.165 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.164 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.163 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.162 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.161 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.160 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.159 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.158 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.157 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.156 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.155 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.153 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.152 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.151 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.149 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.148 db/migrate/20161103091319_create_hd_patient_statistics.rb