Files
fixin.me/db/migrate/20250121230456_create_readouts.rb
2026-05-05 20:36:51 +02:00

17 lines
604 B
Ruby

class CreateReadouts < ActiveRecord::Migration[8.1]
def change
create_table :readouts do |t|
t.references :user, null: false, foreign_key: {on_delete: :cascade}
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.references :collector, foreign_key: true
#t.references :device, foreign_key: true
t.timestamps
end
end
end