Merge remote-tracking branch 'parent/main' into kb_migration
This commit is contained in:
commit
fdf1d6df38
41 changed files with 752 additions and 569 deletions
|
@ -90,7 +90,7 @@ class BackfillAdminActionLogs < ActiveRecord::Migration[6.1]
|
|||
log.update_attribute('route_param', log.user.account_id)
|
||||
end
|
||||
|
||||
Admin::ActionLog.where(target_type: 'Report', human_identifier: nil).in_batches.update_all('human_identifier = target_id::text')
|
||||
AdminActionLog.where(target_type: 'Report', human_identifier: nil).in_batches.update_all('human_identifier = target_id::text')
|
||||
|
||||
AdminActionLog.includes(:domain_block).where(target_type: 'DomainBlock').find_each do |log|
|
||||
next if log.domain_block.nil?
|
||||
|
|
|
@ -90,7 +90,7 @@ class BackfillAdminActionLogsAgain < ActiveRecord::Migration[6.1]
|
|||
log.update_attribute('route_param', log.user.account_id)
|
||||
end
|
||||
|
||||
Admin::ActionLog.where(target_type: 'Report', human_identifier: nil).in_batches.update_all('human_identifier = target_id::text')
|
||||
AdminActionLog.where(target_type: 'Report', human_identifier: nil).in_batches.update_all('human_identifier = target_id::text')
|
||||
|
||||
AdminActionLog.includes(:domain_block).where(target_type: 'DomainBlock').find_each do |log|
|
||||
next if log.domain_block.nil?
|
||||
|
|
27
db/post_migrate/20230904134623_fix_kmr_locale_settings.rb
Normal file
27
db/post_migrate/20230904134623_fix_kmr_locale_settings.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class FixKmrLocaleSettings < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
class MigrationUser < ApplicationRecord
|
||||
self.table_name = :users
|
||||
end
|
||||
|
||||
def up
|
||||
MigrationUser.reset_column_information
|
||||
|
||||
MigrationUser.where.not(settings: [nil, '{}']).find_each do |user|
|
||||
user_settings = Oj.load(user.settings)
|
||||
next unless user_settings['default_language'] == 'kmr'
|
||||
|
||||
user_settings['default_language'] = 'ku'
|
||||
user.update!(settings: Oj.dump(user_settings))
|
||||
end
|
||||
|
||||
MigrationUser.where.not(chosen_languages: nil).where('chosen_languages && ?', '{kmr}').find_each do |user|
|
||||
user.update!(chosen_languages: user.chosen_languages.map { |lang| lang == 'kmr' ? 'ku' : lang }.uniq)
|
||||
end
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_08_26_023400) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_09_04_134623) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue