Migrations for new `received` order state (s. #779)
This commit is contained in:
parent
64113ab7f6
commit
a96dbd563b
|
@ -0,0 +1,11 @@
|
|||
class IntroduceReceivedStateInOrders < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
Order.where(state: 'finished').each do |order|
|
||||
order.update_attribute(:state, 'received') if order.order_articles.where('units_received IS NOT NULL').any?
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
Order.where(state: 'received').update_all(state: 'finished')
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_12_05_010000) do
|
||||
ActiveRecord::Schema.define(version: 2021_02_05_090257) do
|
||||
|
||||
create_table "article_categories", force: :cascade do |t|
|
||||
t.string "name", default: "", null: false
|
||||
|
|
Loading…
Reference in New Issue