mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Add data migration
This commit is contained in:
12
db/migrate/20220114110920_update_order_cycle_mails.rb
Normal file
12
db/migrate/20220114110920_update_order_cycle_mails.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class UpdateOrderCycleMails < ActiveRecord::Migration[6.1]
|
||||
class MigrationOrderCycle < ActiveRecord::Base
|
||||
self.table_name = "order_cycles"
|
||||
end
|
||||
|
||||
def up
|
||||
MigrationOrderCycle.
|
||||
where(automatic_notifications: true).
|
||||
where.not(processed_at: nil).
|
||||
update_all(mails_sent: true)
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_01_12_102539) do
|
||||
ActiveRecord::Schema.define(version: 2022_01_14_110920) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
Reference in New Issue
Block a user