Drop Readout.value decimal type in favor of float

This commit is contained in:
2026-03-19 19:15:47 +01:00
parent 5ed066ad18
commit 687e6fcdff
4 changed files with 46 additions and 6 deletions

View File

@@ -1,10 +1,14 @@
class CreateReadouts < ActiveRecord::Migration[7.2]
def change
create_table :readouts do |t|
t.references :user, null: false, foreign_key: true
# Reference :user through :quantity (:measurement may be NULL).
t.references :measurement, foreign_key: true
t.references :quantity, null: false, foreign_key: true
# :category + :value + :unit as a separate table? (NumericValue, TextValue)
t.integer :category, null: false, default: 0
t.float :value, null: false, limit: Float::MANT_DIG
t.references :unit, foreign_key: true
t.decimal :value, null: false, precision: 30, scale: 15
# Move to Measurement?
#t.references :collector, foreign_key: true
#t.references :device, foreign_key: true