Skip to content

Commit

Permalink
Change container_quota_items float columns to decimals
Browse files Browse the repository at this point in the history
Fixes ManageIQ/manageiq-providers-kubernetes#208
Kubernetes quotas are mostly integers but cpu-related quotas are
in "millicores", multiples of 0.001.
With decimal columns, we'll be able to round-trip quotas exactly to DB
and back to Ruby, so refresh can determine whether they changed or not.

https://bugzilla.redhat.com/show_bug.cgi?id=1504560
  • Loading branch information
cben committed Jan 10, 2018
1 parent 3d99ebd commit 6985fae
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class ChangeContainerQuotaItemsToDecimals < ActiveRecord::Migration[5.0]
def up
%i(quota_desired quota_enforced quota_observed).each do |column|
change_column :container_quota_items, column, :decimal, :scale => 3, :precision => 30
end
end

def down
%i(quota_desired quota_enforced quota_observed).each do |column|
change_column :container_quota_items, column, :float
end
end
end

0 comments on commit 6985fae

Please sign in to comment.