Merge commit '2b11376411
' into kb_migration
This commit is contained in:
commit
ceec3a92cd
336 changed files with 4018 additions and 2492 deletions
|
@ -1,4 +1,4 @@
|
|||
class AddDescriptionToMediaAttachments < ActiveRecord::Migration[5.1]
|
||||
class AddDescriptionToMediaAttachments < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :media_attachments, :description, :text
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateEmailDomainBlocks < ActiveRecord::Migration[5.1]
|
||||
class CreateEmailDomainBlocks < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :email_domain_blocks do |t|
|
||||
t.string :domain, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateAccountModerationNotes < ActiveRecord::Migration[5.1]
|
||||
class CreateAccountModerationNotes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :account_moderation_notes do |t|
|
||||
t.text :content, null: false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddDisabledToCustomEmojis < ActiveRecord::Migration[5.1]
|
||||
class AddDisabledToCustomEmojis < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddUriToCustomEmojis < ActiveRecord::Migration[5.1]
|
||||
class AddUriToCustomEmojis < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :custom_emojis, :uri, :string
|
||||
add_column :custom_emojis, :image_remote_url, :string
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddForeignKeyToAccountModerationNotes < ActiveRecord::Migration[5.1]
|
||||
class AddForeignKeyToAccountModerationNotes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured { add_foreign_key :account_moderation_notes, :accounts }
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChangeAccountsNonnullableInAccountModerationNotes < ActiveRecord::Migration[5.1]
|
||||
class ChangeAccountsNonnullableInAccountModerationNotes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
change_column_null :account_moderation_notes, :account_id, false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddVisibleInPickerToCustomEmoji < ActiveRecord::Migration[5.1]
|
||||
class AddVisibleInPickerToCustomEmoji < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
add_column :custom_emojis, :visible_in_picker, :boolean, default: true, null: false
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddReblogsToFollows < ActiveRecord::Migration[5.1]
|
||||
class AddReblogsToFollows < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddMemorialToAccounts < ActiveRecord::Migration[5.1]
|
||||
class AddMemorialToAccounts < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddDisabledToUsers < ActiveRecord::Migration[5.1]
|
||||
class AddDisabledToUsers < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddModeratorToAccounts < ActiveRecord::Migration[5.1]
|
||||
class AddModeratorToAccounts < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexDomainToEmailDomainBlocks < ActiveRecord::Migration[5.1]
|
||||
class AddIndexDomainToEmailDomainBlocks < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateLists < ActiveRecord::Migration[5.1]
|
||||
class CreateLists < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :lists do |t|
|
||||
t.references :account, foreign_key: { on_delete: :cascade }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateListAccounts < ActiveRecord::Migration[5.1]
|
||||
class CreateListAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :list_accounts do |t|
|
||||
t.belongs_to :list, foreign_key: { on_delete: :cascade }, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddMovedToAccountIdToAccounts < ActiveRecord::Migration[5.1]
|
||||
class AddMovedToAccountIdToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :moved_to_account_id, :bigint, null: true, default: nil
|
||||
safety_assured { add_foreign_key :accounts, :accounts, column: :moved_to_account_id, on_delete: :nullify }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateAdminActionLogs < ActiveRecord::Migration[5.1]
|
||||
class CreateAdminActionLogs < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :admin_action_logs do |t|
|
||||
t.belongs_to :account, foreign_key: { on_delete: :cascade }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexAccountAndReblogOfIdToStatuses < ActiveRecord::Migration[5.1]
|
||||
class AddIndexAccountAndReblogOfIdToStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateInvites < ActiveRecord::Migration[5.1]
|
||||
class CreateInvites < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :invites do |t|
|
||||
t.belongs_to :user, foreign_key: { on_delete: :cascade }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddInviteIdToUsers < ActiveRecord::Migration[5.1]
|
||||
class AddInviteIdToUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured { add_reference :users, :invite, null: true, default: nil, foreign_key: { on_delete: :nullify }, index: false }
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexReblogOfIdAndAccountToStatuses < ActiveRecord::Migration[5.1]
|
||||
class AddIndexReblogOfIdAndAccountToStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RemoveOldReblogIndexOnStatuses < ActiveRecord::Migration[5.1]
|
||||
class RemoveOldReblogIndexOnStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexOnStreamEntries < ActiveRecord::Migration[5.1]
|
||||
class AddIndexOnStreamEntries < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddEmbedURLToPreviewCards < ActiveRecord::Migration[5.1]
|
||||
class AddEmbedURLToPreviewCards < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChangeAccountIdNonnullableInLists < ActiveRecord::Migration[5.1]
|
||||
class ChangeAccountIdNonnullableInLists < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
change_column_null :lists, :account_id, false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RemoveDuplicateIndexesInLists < ActiveRecord::Migration[5.1]
|
||||
class RemoveDuplicateIndexesInLists < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_index :list_accounts, name: 'index_list_accounts_on_account_id'
|
||||
remove_index :list_accounts, name: 'index_list_accounts_on_list_id'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MoreFasterIndexOnNotifications < ActiveRecord::Migration[5.1]
|
||||
class MoreFasterIndexOnNotifications < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.1]
|
||||
class AddIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddRememberTokenToUsers < ActiveRecord::Migration[5.1]
|
||||
class AddRememberTokenToUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :users, :remember_token, :string, null: true
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class CreateIdentities < ActiveRecord::Migration[5.0]
|
||||
class CreateIdentities < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :identities do |t|
|
||||
t.references :user, foreign_key: { on_delete: :cascade }
|
||||
create_table :identities, id: :integer do |t|
|
||||
t.references :user, type: :integer, foreign_key: { on_delete: :cascade }
|
||||
t.string :provider, null: false, default: ''
|
||||
t.string :uid, null: false, default: ''
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChangeUserIdNonnullable < ActiveRecord::Migration[5.1]
|
||||
class ChangeUserIdNonnullable < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
change_column_null :invites, :user_id, false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateBackups < ActiveRecord::Migration[5.1]
|
||||
class CreateBackups < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :backups do |t|
|
||||
t.references :user, foreign_key: { on_delete: :nullify }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddFeaturedCollectionURLToAccounts < ActiveRecord::Migration[5.1]
|
||||
class AddFeaturedCollectionURLToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :featured_collection_url, :string
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChangeColumnsInNotificationsNonnullable < ActiveRecord::Migration[5.1]
|
||||
class ChangeColumnsInNotificationsNonnullable < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
change_column_null :notifications, :activity_id, false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddAssignedAccountIdToReports < ActiveRecord::Migration[5.1]
|
||||
class AddAssignedAccountIdToReports < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured { add_reference :reports, :assigned_account, null: true, default: nil, foreign_key: { on_delete: :nullify, to_table: :accounts }, index: false }
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateReportNotes < ActiveRecord::Migration[5.1]
|
||||
class CreateReportNotes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :report_notes do |t|
|
||||
t.text :content, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AddFieldsToAccounts < ActiveRecord::Migration[5.1]
|
||||
class AddFieldsToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :fields, :jsonb
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ImproveIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.1]
|
||||
class ImproveIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
# These changes ware reverted by migration 20180514140000.
|
||||
# These changes were reverted by migration 20180514140000.
|
||||
# add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
|
||||
# add_index :statuses, [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
|
||||
# remove_index :statuses, column: [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RevertIndexChangeOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.1]
|
||||
class RevertIndexChangeOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CreateBookmarks < ActiveRecord::Migration[5.1]
|
||||
class CreateBookmarks < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :bookmarks do |t|
|
||||
t.references :account, null: false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class ChangeListAccountFollowNullable < ActiveRecord::Migration[5.1]
|
||||
class ChangeListAccountFollowNullable < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
change_column_null :list_accounts, :follow_id, true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MediaAttachmentIdsToTimestampIds < ActiveRecord::Migration[5.1]
|
||||
class MediaAttachmentIdsToTimestampIds < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
# Set up the media_attachments.id column to use our timestamp-based IDs.
|
||||
safety_assured do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddNotifyToFollows < ActiveRecord::Migration[5.1]
|
||||
class AddNotifyToFollows < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AccountIdsToTimestampIds < ActiveRecord::Migration[5.1]
|
||||
class AccountIdsToTimestampIds < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
# Set up the accounts.id column to use our timestamp-based IDs.
|
||||
safety_assured do
|
||||
|
|
7
db/migrate/20230215074327_add_settings_to_users.rb
Normal file
7
db/migrate/20230215074327_add_settings_to_users.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddSettingsToUsers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :users, :settings, :text
|
||||
end
|
||||
end
|
84
db/migrate/20230215074423_move_user_settings.rb
Normal file
84
db/migrate/20230215074423_move_user_settings.rb
Normal file
|
@ -0,0 +1,84 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MoveUserSettings < ActiveRecord::Migration[6.1]
|
||||
class User < ApplicationRecord; end
|
||||
|
||||
MAPPING = {
|
||||
default_privacy: 'default_privacy',
|
||||
default_sensitive: 'web.default_sensitive',
|
||||
default_language: 'default_language',
|
||||
noindex: 'noindex',
|
||||
theme: 'theme',
|
||||
trends: 'web.trends',
|
||||
unfollow_modal: 'web.unfollow_modal',
|
||||
boost_modal: 'web.reblog_modal',
|
||||
delete_modal: 'web.delete_modal',
|
||||
auto_play_gif: 'web.auto_play',
|
||||
display_media: 'web.display_media',
|
||||
expand_spoilers: 'web.expand_content_warnings',
|
||||
reduce_motion: 'web.reduce_motion',
|
||||
disable_swiping: 'web.disable_swiping',
|
||||
show_application: 'show_application',
|
||||
system_font_ui: 'web.use_system_font',
|
||||
aggregate_reblogs: 'aggregate_reblogs',
|
||||
advanced_layout: 'web.advanced_layout',
|
||||
use_blurhash: 'web.use_blurhash',
|
||||
use_pending_items: 'web.use_pending_items',
|
||||
crop_images: 'web.crop_images',
|
||||
notification_emails: {
|
||||
follow: 'notification_emails.follow',
|
||||
reblog: 'notification_emails.reblog',
|
||||
favourite: 'notification_emails.favourite',
|
||||
mention: 'notification_emails.mention',
|
||||
follow_request: 'notification_emails.follow_request',
|
||||
report: 'notification_emails.report',
|
||||
pending_account: 'notification_emails.pending_account',
|
||||
trending_tag: 'notification_emails.trends',
|
||||
appeal: 'notification_emails.appeal',
|
||||
}.freeze,
|
||||
always_send_emails: 'always_send_emails',
|
||||
interactions: {
|
||||
must_be_follower: 'interactions.must_be_follower',
|
||||
must_be_following: 'interactions.must_be_following',
|
||||
must_be_following_dm: 'interactions.must_be_following_dm',
|
||||
}.freeze,
|
||||
}.freeze
|
||||
|
||||
class LegacySetting < ApplicationRecord
|
||||
self.table_name = 'settings'
|
||||
|
||||
def var
|
||||
self[:var]&.to_sym
|
||||
end
|
||||
|
||||
def value
|
||||
YAML.safe_load(self[:value], permitted_classes: [ActiveSupport::HashWithIndifferentAccess]) if self[:value].present?
|
||||
end
|
||||
end
|
||||
|
||||
def up
|
||||
User.find_each do |user|
|
||||
previous_settings = LegacySetting.where(thing_type: 'User', thing_id: user.id).index_by(&:var)
|
||||
|
||||
user_settings = {}
|
||||
|
||||
MAPPING.each do |legacy_key, new_key|
|
||||
value = previous_settings[legacy_key]&.value
|
||||
|
||||
next if value.blank?
|
||||
|
||||
if value.is_a?(Hash)
|
||||
value.each do |nested_key, nested_value|
|
||||
user_settings[MAPPING[legacy_key][nested_key.to_sym]] = nested_value
|
||||
end
|
||||
else
|
||||
user_settings[new_key] = value
|
||||
end
|
||||
end
|
||||
|
||||
user.update_column('settings', Oj.dump(user_settings)) # rubocop:disable Rails/SkipsModelValidations
|
||||
end
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
class RemoveSubscriptionExpiresAtFromAccounts < ActiveRecord::Migration[5.0]
|
||||
class RemoveSubscriptionExpiresAtFromAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
safety_assured do
|
||||
remove_column :accounts, :subscription_expires_at, :datetime, null: true, default: nil
|
||||
remove_column :accounts, :subscription_expires_at, :datetime, null: true, default: nil, precision: nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1089,6 +1089,7 @@ ActiveRecord::Schema.define(version: 2023_03_20_234918) do
|
|||
t.inet "sign_up_ip"
|
||||
t.boolean "skip_sign_in_token"
|
||||
t.bigint "role_id"
|
||||
t.text "settings"
|
||||
t.index ["account_id"], name: "index_users_on_account_id"
|
||||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||
t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id", where: "(created_by_application_id IS NOT NULL)"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Dir[Rails.root.join('db', 'seeds', '*.rb')].sort.each do |seed|
|
||||
load seed
|
||||
Chewy.strategy(:mastodon) do
|
||||
Dir[Rails.root.join('db', 'seeds', '*.rb')].sort.each do |seed|
|
||||
load seed
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue