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.0.pre.rc9 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc8 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc7 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc6 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc5 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc4 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc3 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.rc1 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta12 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta11 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta10 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta9 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta8 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta7 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta6 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta5 db/migrate/20161103091319_create_hd_patient_statistics.rb
renalware-core-2.0.0.pre.beta4 db/migrate/20161103091319_create_hd_patient_statistics.rb