Skip to content

Commit

Permalink
feat: add conversion_rate to reactions_samples table and run migratio…
Browse files Browse the repository at this point in the history
…n and annotation for relevant models
  • Loading branch information
adambasha0 committed Sep 17, 2024
1 parent 8501ec5 commit 49e7400
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 67 deletions.
2 changes: 2 additions & 0 deletions app/models/reaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# variations :jsonb
# plain_text_description :text
# plain_text_observation :text
# gaseous :boolean default(FALSE)
# vessel_size :jsonb
#
# Indexes
#
Expand Down
25 changes: 14 additions & 11 deletions app/models/reactions_product_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
#
# Table name: reactions_samples
#
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# gas_type :integer default("off")
# gas_phase_data :jsonb
# conversion_rate :float
#
# Indexes
#
Expand Down
25 changes: 14 additions & 11 deletions app/models/reactions_purification_solvent_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
#
# Table name: reactions_samples
#
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# gas_type :integer default("off")
# gas_phase_data :jsonb
# conversion_rate :float
#
# Indexes
#
Expand Down
25 changes: 14 additions & 11 deletions app/models/reactions_reactant_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
#
# Table name: reactions_samples
#
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# gas_type :integer default("off")
# gas_phase_data :jsonb
# conversion_rate :float
#
# Indexes
#
Expand Down
25 changes: 14 additions & 11 deletions app/models/reactions_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
#
# Table name: reactions_samples
#
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# gas_type :integer default("off")
# gas_phase_data :jsonb
# conversion_rate :float
#
# Indexes
#
Expand Down
25 changes: 14 additions & 11 deletions app/models/reactions_solvent_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
#
# Table name: reactions_samples
#
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# gas_type :integer default("off")
# gas_phase_data :jsonb
# conversion_rate :float
#
# Indexes
#
Expand Down
25 changes: 14 additions & 11 deletions app/models/reactions_starting_material_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
#
# Table name: reactions_samples
#
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# id :integer not null, primary key
# reaction_id :integer
# sample_id :integer
# reference :boolean
# equivalent :float
# position :integer
# type :string
# deleted_at :datetime
# waste :boolean default(FALSE)
# coefficient :float default(1.0)
# show_label :boolean default(FALSE), not null
# gas_type :integer default("off")
# gas_phase_data :jsonb
# conversion_rate :float
#
# Indexes
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddConversionRateToReactionsSamples < ActiveRecord::Migration[6.1]
def change
add_column :reactions_samples, :conversion_rate, :float, null: true
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2024_07_11_120833) do
ActiveRecord::Schema.define(version: 2024_09_17_085816) do

# These are extensions that must be enabled in order to support this database
enable_extension "hstore"
Expand Down Expand Up @@ -983,6 +983,7 @@
t.boolean "show_label", default: false, null: false
t.integer "gas_type", default: 0
t.jsonb "gas_phase_data", default: {"time"=>{"unit"=>"h", "value"=>nil}, "temperature"=>{"unit"=>"°C", "value"=>nil}, "turnover_number"=>nil, "part_per_million"=>nil, "turnover_frequency"=>{"unit"=>"TON/h", "value"=>nil}}
t.float "conversion_rate"
t.index ["reaction_id"], name: "index_reactions_samples_on_reaction_id"
t.index ["sample_id"], name: "index_reactions_samples_on_sample_id"
end
Expand Down

0 comments on commit 49e7400

Please sign in to comment.