1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/db/migrate/004_create_readouts.rb
cryptogopher 687269062c Added measurement, readout and readout_value models
commands:
rails generate redmine_plugin_model body_tracking measurement
name:string hidden:boolean source:references
rails generate redmine_plugin_model body_tracking readout
measurement:references quantity:references unit:references
rails generate redmine_plugin_model body_tracking readout_value
readout:references value:decimal taken_at:timestamp
2019-11-15 21:52:12 +01:00

13 lines
407 B
Ruby

class CreateReadouts < ActiveRecord::Migration
def change
create_table :readouts do |t|
t.references :measurement, index: true, foreign_key: true
t.references :quantity, index: true, foreign_key: true
t.references :unit, index: true, foreign_key: true
end
add_index :readouts, :measurement_id
add_index :readouts, :quantity_id
add_index :readouts, :unit_id
end
end