Merged new models migrations
This commit is contained in:
parent
687269062c
commit
793edbe7ae
@ -47,5 +47,27 @@ class CreateSchema < ActiveRecord::Migration
|
||||
t.references :unit
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :measurements do |t|
|
||||
t.references :project
|
||||
t.string :name
|
||||
t.boolean :hidden
|
||||
t.references :source
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :readouts do |t|
|
||||
t.references :measurement
|
||||
t.references :quantity
|
||||
t.references :unit
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :readout_values do |t|
|
||||
t.references :readout
|
||||
t.decimal :value, precision: 12, scale: 6
|
||||
t.timestamp :taken_at
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +0,0 @@
|
||||
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
|
@ -1,12 +0,0 @@
|
||||
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
|
@ -1,10 +0,0 @@
|
||||
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
|
Reference in New Issue
Block a user