mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Ensure that producer properties have a position
This commit is contained in:
@@ -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
|
||||
10
db/schema.rb
10
db/schema.rb
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user