Merge remote-tracking branch 'tootsuite/main' into custom/quote
This commit is contained in:
@@ -16,7 +16,7 @@ class FixReblogsInFeeds < ActiveRecord::Migration[5.1]
|
||||
# is once again set to the reblogging status' ID, and the value
|
||||
# is set to the reblogged status' ID). This is safe for Redis'
|
||||
# float conversion because in this reblog tracking zset, we only
|
||||
# need the rebloggging status' ID to be able to stop tracking
|
||||
# need the reblogging status' ID to be able to stop tracking
|
||||
# entries after they have gotten too far down the feed, which
|
||||
# does not require an exact value.
|
||||
|
||||
|
@@ -22,13 +22,13 @@ class RejectFollowingBlockedUsers < ActiveRecord::Migration[5.2]
|
||||
|
||||
follows.each do |follow|
|
||||
blocked_account = follow.account
|
||||
followed_acccount = follow.target_account
|
||||
followed_account = follow.target_account
|
||||
|
||||
next follow.destroy! if blocked_account.local?
|
||||
|
||||
reject_follow_json = Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(follow, serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(followed_acccount))
|
||||
reject_follow_json = Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(follow, serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(followed_account))
|
||||
|
||||
ActivityPub::DeliveryWorker.perform_async(reject_follow_json, followed_acccount, blocked_account.inbox_url)
|
||||
ActivityPub::DeliveryWorker.perform_async(reject_follow_json, followed_account, blocked_account.inbox_url)
|
||||
|
||||
follow.destroy!
|
||||
end
|
||||
|
@@ -5,7 +5,7 @@ class AddAutofollowToInvites < ActiveRecord::Migration[5.2]
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
def up
|
||||
safety_assured do
|
||||
add_column_with_default :invites, :autofollow, :bool, default: false, allow_null: false
|
||||
end
|
||||
|
@@ -2,6 +2,14 @@ class AddInstanceActor < ActiveRecord::Migration[5.2]
|
||||
class Account < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
validates :username, uniqueness: { scope: :domain, case_sensitive: false }
|
||||
|
||||
before_create :generate_keys
|
||||
|
||||
def generate_keys
|
||||
keypair = OpenSSL::PKey::RSA.new(2048)
|
||||
self.private_key = keypair.to_pem
|
||||
self.public_key = keypair.public_key.to_pem
|
||||
end
|
||||
end
|
||||
|
||||
def up
|
||||
|
@@ -16,7 +16,7 @@ class AddFixedLowercaseIndexToAccounts < ActiveRecord::Migration[5.2]
|
||||
add_index :accounts, "lower (username), COALESCE(lower(domain), '')", name: 'index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
remove_index :accounts, name: 'index_accounts_on_username_and_domain_lower'
|
||||
raise CorruptionError
|
||||
raise CorruptionError.new('index_accounts_on_username_and_domain_lower')
|
||||
end
|
||||
|
||||
remove_index :accounts, name: 'old_index_accounts_on_username_and_domain_lower' if index_name_exists?(:accounts, 'old_index_accounts_on_username_and_domain_lower')
|
||||
|
@@ -10,7 +10,7 @@ class AddCaseInsensitiveBtreeIndexToTags < ActiveRecord::Migration[5.2]
|
||||
safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower_btree ON tags (lower(name) text_pattern_ops)' }
|
||||
rescue ActiveRecord::StatementInvalid => e
|
||||
remove_index :tags, name: 'index_tags_on_name_lower_btree'
|
||||
raise CorruptionError if e.is_a?(ActiveRecord::RecordNotUnique)
|
||||
raise CorruptionError.new('index_tags_on_name_lower_btree') if e.is_a?(ActiveRecord::RecordNotUnique)
|
||||
raise e
|
||||
end
|
||||
|
||||
|
@@ -0,0 +1,6 @@
|
||||
class AddLastUsedAtToOauthAccessTokens < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :oauth_access_tokens, :last_used_at, :datetime
|
||||
add_column :oauth_access_tokens, :last_used_ip, :inet
|
||||
end
|
||||
end
|
@@ -0,0 +1,5 @@
|
||||
class AddOrderedMediaAttachmentIdsToStatuses < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :statuses, :ordered_media_attachment_ids, :bigint, array: true
|
||||
end
|
||||
end
|
@@ -0,0 +1,8 @@
|
||||
class AddOrderedMediaAttachmentIdsToStatusEdits < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :status_edits, :ordered_media_attachment_ids, :bigint, array: true
|
||||
add_column :status_edits, :media_descriptions, :text, array: true
|
||||
add_column :status_edits, :poll_options, :string, array: true
|
||||
add_column :status_edits, :sensitive, :boolean
|
||||
end
|
||||
end
|
37
db/migrate/20220304195405_migrate_hide_network_preference.rb
Normal file
37
db/migrate/20220304195405_migrate_hide_network_preference.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
class MigrateHideNetworkPreference < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
# Dummy classes, to make migration possible across version changes
|
||||
class Account < ApplicationRecord
|
||||
has_one :user, inverse_of: :account
|
||||
scope :local, -> { where(domain: nil) }
|
||||
end
|
||||
|
||||
class User < ApplicationRecord
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
def up
|
||||
Account.reset_column_information
|
||||
|
||||
Setting.unscoped.where(thing_type: 'User', var: 'hide_network').find_each do |setting|
|
||||
account = User.find(setting.thing_id).account
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
account.update(hide_collections: setting.value)
|
||||
setting.delete
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
Account.local.where(hide_collections: true).includes(:user).find_each do |account|
|
||||
ApplicationRecord.transaction do
|
||||
Setting.create(thing_type: 'User', thing_id: account.user.id, var: 'hide_network', value: account.hide_collections?)
|
||||
account.update(hide_collections: nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
17
db/migrate/20220307094650_fix_featured_tags_constraints.rb
Normal file
17
db/migrate/20220307094650_fix_featured_tags_constraints.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class FixFeaturedTagsConstraints < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
safety_assured do
|
||||
execute 'DELETE FROM featured_tags WHERE tag_id IS NULL'
|
||||
change_column_null :featured_tags, :tag_id, false
|
||||
execute 'DELETE FROM featured_tags WHERE account_id IS NULL'
|
||||
change_column_null :featured_tags, :account_id, false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
change_column_null :featured_tags, :tag_id, true
|
||||
change_column_null :featured_tags, :account_id, true
|
||||
end
|
||||
end
|
||||
end
|
9
db/migrate/20220309213005_fix_reblog_deleted_at.rb
Normal file
9
db/migrate/20220309213005_fix_reblog_deleted_at.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class FixReblogDeletedAt < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { execute 'UPDATE statuses s SET deleted_at = r.deleted_at FROM statuses r WHERE s.reblog_of_id = r.id AND r.deleted_at IS NOT NULL' }
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
17
db/migrate/20220316233212_update_kurdish_locales.rb
Normal file
17
db/migrate/20220316233212_update_kurdish_locales.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class UpdateKurdishLocales < ActiveRecord::Migration[6.1]
|
||||
class User < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
end
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
User.where(locale: 'ku').in_batches.update_all(locale: 'ckb')
|
||||
User.where(locale: 'kmr').in_batches.update_all(locale: 'ku')
|
||||
end
|
||||
|
||||
def down
|
||||
User.where(locale: 'ku').in_batches.update_all(locale: 'kmr')
|
||||
User.where(locale: 'ckb').in_batches.update_all(locale: 'ku')
|
||||
end
|
||||
end
|
@@ -0,0 +1,7 @@
|
||||
class AddIndexStatusesOnAccountId < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :statuses, [:account_id], name: :index_statuses_on_account_id, algorithm: :concurrently
|
||||
end
|
||||
end
|
@@ -0,0 +1,7 @@
|
||||
class AddIndexStatusesPinsOnStatusId < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :status_pins, [:status_id], name: :index_status_pins_on_status_id, algorithm: :concurrently
|
||||
end
|
||||
end
|
@@ -0,0 +1,7 @@
|
||||
class AddIndexReportsOnAssignedAccountId < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :reports, [:assigned_account_id], name: :index_reports_on_assigned_account_id, algorithm: :concurrently, where: 'assigned_account_id IS NOT NULL'
|
||||
end
|
||||
end
|
@@ -0,0 +1,7 @@
|
||||
class AddIndexReportsOnActionTakenByAccountId < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :reports, [:action_taken_by_account_id], name: :index_reports_on_action_taken_by_account_id, algorithm: :concurrently, where: 'action_taken_by_account_id IS NOT NULL'
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user