discourse/plugins/automation/db/migrate/20210512090204_add_timestam...

17 lines
492 B
Ruby

# frozen_string_literal: true
class AddTimestampsToAutomations < ActiveRecord::Migration[6.1]
def change
add_column :discourse_automation_automations, :last_updated_by_id, :integer, null: true
DB.exec(<<~SQL, user_id: Discourse::SYSTEM_USER_ID)
UPDATE discourse_automation_automations
SET last_updated_by_id = :user_id
SQL
execute <<~SQL
ALTER TABLE discourse_automation_automations ALTER COLUMN last_updated_by_id SET NOT NULL;
SQL
end
end