Skip to content

Commit

Permalink
feat(db/migrations) update prices for default diapers calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
loqimean committed Feb 15, 2023
1 parent 6ea56d9 commit a59085f
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
class UpdateDiapersCalculatorValuesAppConfig < ActiveRecord::Migration[6.1]
def up
AppConfig.instance.tap do |ac|
ac.diapers_calculator = {
(1..3) => {
amount: 10,
price: 7.81
},
(4..6) => {
amount: 8,
price: 9.09
},
(7..9) => {
amount: 6,
price: 8.8
},
(10..12) => {
amount: 6,
price: 10.47
},
(13..18) => {
amount: 4,
price: 10.47
},
(19..24) => {
amount: 4,
price: 12.06
},
(25..30) => {
amount: 2,
price: 12.06
}
}
ac.save
end
end

def down
AppConfig.instance.tap do |ac|
ac.diapers_calculator = {
(1..3) => {
amount: 10,
price: 4
},
(4..6) => {
amount: 8,
price: 4.5
},
(7..9) => {
amount: 6,
price: 5
},
(10..12) => {
amount: 6,
price: 5.5
},
(13..18) => {
amount: 4,
price: 5.5
},
(19..24) => {
amount: 4,
price: 6
},
(25..30) => {
amount: 2,
price: 6
}
}
ac.save
end
end
end
2 changes: 1 addition & 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: 2022_12_18_110600) do
ActiveRecord::Schema.define(version: 2023_02_15_195330) do

# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
Expand Down

0 comments on commit a59085f

Please sign in to comment.