Ensure that producer properties have a position

This commit is contained in:
Rob Harrington
2015-04-24 13:05:01 +10:00
parent c66a7e44b6
commit bdf462926d
2 changed files with 14 additions and 5 deletions

View File

@@ -0,0 +1,9 @@
class AddDefaultAndNotNullToProducerPropertiesPosition < ActiveRecord::Migration
def change
ProducerProperty.where(position: nil).each do |producer_property|
producer_property.update_attribute(:position, 0)
end
change_column :producer_properties, :position, :integer, null: false, default: 0
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150422014819) do
ActiveRecord::Schema.define(:version => 20150424025907) do
create_table "adjustment_metadata", :force => true do |t|
t.integer "adjustment_id"
@@ -373,9 +373,9 @@ ActiveRecord::Schema.define(:version => 20150422014819) do
t.string "value"
t.integer "producer_id"
t.integer "property_id"
t.integer "position"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "position", :default => 0, :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "producer_properties", ["position"], :name => "index_producer_properties_on_position"
@@ -618,9 +618,9 @@ ActiveRecord::Schema.define(:version => 20150422014819) do
t.string "email"
t.text "special_instructions"
t.integer "distributor_id"
t.integer "order_cycle_id"
t.string "currency"
t.string "last_ip_address"
t.integer "order_cycle_id"
t.integer "cart_id"
end