1
0

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
This commit is contained in:
cryptogopher 2019-11-15 21:52:12 +01:00
parent b617043dd5
commit 687269062c
9 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,2 @@
class Measurement < ActiveRecord::Base
end

2
app/models/readout.rb Normal file
View File

@ -0,0 +1,2 @@
class Readout < ActiveRecord::Base
end

View File

@ -0,0 +1,2 @@
class ReadoutValue < ActiveRecord::Base
end

View File

@ -0,0 +1,10 @@
class CreateMeasurements < ActiveRecord::Migration
def change
create_table :measurements do |t|
t.string :name
t.boolean :hidden
t.references :source, index: true, foreign_key: true
end
add_index :measurements, :source_id
end
end

View File

@ -0,0 +1,12 @@
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

View File

@ -0,0 +1,10 @@
class CreateReadoutValues < ActiveRecord::Migration
def change
create_table :readout_values do |t|
t.references :readout, index: true, foreign_key: true
t.decimal :value
t.timestamp :taken_at
end
add_index :readout_values, :readout_id
end
end

View File

@ -0,0 +1,9 @@
require File.expand_path('../../test_helper', __FILE__)
class MeasurementTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@ -0,0 +1,9 @@
require File.expand_path('../../test_helper', __FILE__)
class ReadoutTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

View File

@ -0,0 +1,9 @@
require File.expand_path('../../test_helper', __FILE__)
class ReadoutValueTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end