Add data migration

This commit is contained in:
Matt-Yorkley
2022-01-14 11:23:41 +00:00
parent 9be37b0aaa
commit 534354a177
2 changed files with 13 additions and 1 deletions

View 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

View File

@@ -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"