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.0.127 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.126 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.125 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.124 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.123 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.121 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.120 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.119 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.118 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.117 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.116 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.115 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.113 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.112 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.111 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.110 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.109 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.108 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.106 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.105 db/migrate/20161103091319_create_hd_patient_statistics.rb