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