This repository has been archived on 2024-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
2020-09-18 11:26:45 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class MigrateNotificationsType < ActiveRecord::Migration[5.2]
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
TYPES_TO_MIGRATE = {
|
2023-02-20 00:58:28 -05:00
|
|
|
'Mention' => :mention,
|
|
|
|
'Status' => :reblog,
|
|
|
|
'Follow' => :follow,
|
2020-09-18 11:26:45 -04:00
|
|
|
'FollowRequest' => :follow_request,
|
2023-02-20 00:58:28 -05:00
|
|
|
'Favourite' => :favourite,
|
|
|
|
'Poll' => :poll,
|
2020-09-18 11:26:45 -04:00
|
|
|
}.freeze
|
|
|
|
|
|
|
|
def up
|
|
|
|
TYPES_TO_MIGRATE.each_pair do |activity_type, type|
|
|
|
|
Notification.where(activity_type: activity_type, type: nil).in_batches.update_all(type: type)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down; end
|
|
|
|
end
|