Skip to content

Commit

Permalink
Merge pull request #246 from sc0v/fractional-store-prices
Browse files Browse the repository at this point in the history
  • Loading branch information
sclark authored Mar 28, 2017
2 parents 0cf483f + e5c81fa commit de1891d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ rvm:
bundler_args: --without development staging production
sudo: false
before_script:
- bundle exec rake db:test:prepare
- bundle exec rake test:prepare
- bundle exec rake db:migrate
2 changes: 1 addition & 1 deletion app/models/store_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# **`created_at`** | `datetime` | `not null`
# **`id`** | `integer` | `not null, primary key`
# **`name`** | `string(255)` |
# **`price`** | `decimal(10, )` |
# **`price`** | `decimal(8, 2)` |
# **`quantity`** | `integer` |
# **`updated_at`** | `datetime` | `not null`
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/store_purchase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# **`charge_id`** | `integer` |
# **`created_at`** | `datetime` | `not null`
# **`id`** | `integer` | `not null, primary key`
# **`price_at_purchase`** | `decimal(10, )` |
# **`price_at_purchase`** | `decimal(8, 2)` |
# **`quantity_purchased`** | `integer` |
# **`store_item_id`** | `integer` |
# **`updated_at`** | `datetime` | `not null`
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20170323163001_change_store_item_price_datatype.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class ChangeStoreItemPriceDatatype < ActiveRecord::Migration
def change
change_column :store_items, :price, :decimal, :precision => 8, :scale => 2
change_column :store_purchases, :price_at_purchase, :decimal, :precision => 8, :scale => 2
end
end
22 changes: 11 additions & 11 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,20 @@
add_index "shifts", ["organization_id"], name: "index_shifts_on_organization_id"

create_table "store_items", force: :cascade do |t|
t.string "name"
t.decimal "price"
t.integer "quantity"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name", limit: 255
t.decimal "price", precision: 8, scale: 2
t.integer "quantity", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "store_purchases", force: :cascade do |t|
t.integer "charge_id"
t.integer "store_item_id"
t.decimal "price_at_purchase"
t.integer "quantity_purchased"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "charge_id", limit: 4
t.integer "store_item_id", limit: 4
t.decimal "price_at_purchase", precision: 8, scale: 2
t.integer "quantity_purchased", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

add_index "store_purchases", ["charge_id"], name: "index_store_purchases_on_charge_id"
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

ActiveRecord::Migration.maintain_test_schema!

class ActiveSupport::TestCase

def deny(condition)
Expand Down

0 comments on commit de1891d

Please sign in to comment.