Merge tag 'v3.3.0' into instance_only_statuses
This commit is contained in:
23
db/migrate/20181127165847_add_show_replies_to_lists.rb
Normal file
23
db/migrate/20181127165847_add_show_replies_to_lists.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddShowRepliesToLists < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured do
|
||||
add_column_with_default(
|
||||
:lists,
|
||||
:replies_policy,
|
||||
:integer,
|
||||
allow_null: false,
|
||||
default: 0
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :lists, :replies_policy
|
||||
end
|
||||
end
|
5
db/migrate/20200309150742_add_forwarded_to_reports.rb
Normal file
5
db/migrate/20200309150742_add_forwarded_to_reports.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddForwardedToReports < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :reports, :forwarded, :boolean
|
||||
end
|
||||
end
|
5
db/migrate/20200317021758_add_expires_at_to_mutes.rb
Normal file
5
db/migrate/20200317021758_add_expires_at_to_mutes.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddExpiresAtToMutes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :mutes, :expires_at, :datetime
|
||||
end
|
||||
end
|
5
db/migrate/20200614002136_add_sensitized_to_accounts.rb
Normal file
5
db/migrate/20200614002136_add_sensitized_to_accounts.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddSensitizedToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :sensitized_at, :datetime
|
||||
end
|
||||
end
|
@ -1,10 +1,30 @@
|
||||
class AddFixedLowercaseIndexToAccounts < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
class CorruptionError < StandardError
|
||||
def cause
|
||||
nil
|
||||
end
|
||||
|
||||
def backtrace
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def up
|
||||
rename_index :accounts, 'index_accounts_on_username_and_domain_lower', 'old_index_accounts_on_username_and_domain_lower' unless index_name_exists?(:accounts, 'old_index_accounts_on_username_and_domain_lower')
|
||||
add_index :accounts, "lower (username), COALESCE(lower(domain), '')", name: 'index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently
|
||||
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') && index_name_exists?(:accounts, 'index_accounts_on_username_and_domain_lower')
|
||||
remove_index :accounts, name: 'index_accounts_on_username_and_domain_lower'
|
||||
elsif index_name_exists?(:accounts, 'index_accounts_on_username_and_domain_lower')
|
||||
rename_index :accounts, 'index_accounts_on_username_and_domain_lower', 'old_index_accounts_on_username_and_domain_lower'
|
||||
end
|
||||
|
||||
begin
|
||||
add_index :accounts, "lower (username), COALESCE(lower(domain), '')", name: 'index_accounts_on_username_and_domain_lower', unique: true, algorithm: :concurrently
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
raise CorruptionError, 'Migration failed because of index corruption, see https://docs.joinmastodon.org/admin/troubleshooting/index-corruption/#fixing'
|
||||
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')
|
||||
end
|
||||
|
||||
def down
|
||||
|
16
db/migrate/20200630190240_create_webauthn_credentials.rb
Normal file
16
db/migrate/20200630190240_create_webauthn_credentials.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class CreateWebauthnCredentials < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :webauthn_credentials do |t|
|
||||
t.string :external_id, null: false
|
||||
t.string :public_key, null: false
|
||||
t.string :nickname, null: false
|
||||
t.bigint :sign_count, null: false, default: 0
|
||||
|
||||
t.index :external_id, unique: true
|
||||
|
||||
t.references :user, foreign_key: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
5
db/migrate/20200630190544_add_webauthn_id_to_users.rb
Normal file
5
db/migrate/20200630190544_add_webauthn_id_to_users.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddWebauthnIdToUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :users, :webauthn_id, :string
|
||||
end
|
||||
end
|
@ -0,0 +1,8 @@
|
||||
class CreateAccountDeletionRequests < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :account_deletion_requests do |t|
|
||||
t.references :account, foreign_key: { on_delete: :cascade }
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
19
db/migrate/20200917192924_add_notify_to_follows.rb
Normal file
19
db/migrate/20200917192924_add_notify_to_follows.rb
Normal file
@ -0,0 +1,19 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddNotifyToFollows < ActiveRecord::Migration[5.1]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured do
|
||||
add_column_with_default :follows, :notify, :boolean, default: false, allow_null: false
|
||||
add_column_with_default :follow_requests, :notify, :boolean, default: false, allow_null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :follows, :notify
|
||||
remove_column :follow_requests, :notify
|
||||
end
|
||||
end
|
5
db/migrate/20200917193034_add_type_to_notifications.rb
Normal file
5
db/migrate/20200917193034_add_type_to_notifications.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddTypeToNotifications < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :notifications, :type, :string
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class AddIndexNotificationsOnType < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :notifications, [:account_id, :id, :type], order: { id: :desc }, algorithm: :concurrently
|
||||
end
|
||||
end
|
12
db/migrate/20201008202037_create_ip_blocks.rb
Normal file
12
db/migrate/20201008202037_create_ip_blocks.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateIpBlocks < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :ip_blocks do |t|
|
||||
t.inet :ip, null: false, default: '0.0.0.0'
|
||||
t.integer :severity, null: false, default: 0
|
||||
t.datetime :expires_at
|
||||
t.text :comment, null: false, default: ''
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
5
db/migrate/20201008220312_add_sign_up_ip_to_users.rb
Normal file
5
db/migrate/20201008220312_add_sign_up_ip_to_users.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddSignUpIpToUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :users, :sign_up_ip, :inet
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddSuspensionOriginToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :suspension_origin, :integer
|
||||
end
|
||||
end
|
9
db/migrate/20201206004238_create_instances.rb
Normal file
9
db/migrate/20201206004238_create_instances.rb
Normal file
@ -0,0 +1,9 @@
|
||||
class CreateInstances < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_view :instances, materialized: true
|
||||
|
||||
# To be able to refresh the view concurrently,
|
||||
# at least one unique index is required
|
||||
safety_assured { add_index :instances, :domain, unique: true }
|
||||
end
|
||||
end
|
15
db/migrate/20201218054746_add_obfuscate_to_domain_blocks.rb
Normal file
15
db/migrate/20201218054746_add_obfuscate_to_domain_blocks.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddObfuscateToDomainBlocks < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { add_column_with_default :domain_blocks, :obfuscate, :boolean, default: false, allow_null: false }
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :domain_blocks, :obfuscate
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user