mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Fix Rails/BulkChangeTable
cop (#26890)
This commit is contained in:
parent
0c4e7c06dc
commit
c501d626e8
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
class AddProfileFieldsToAccounts < ActiveRecord::Migration[4.2]
|
class AddProfileFieldsToAccounts < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
add_column :accounts, :note, :text, null: false, default: ''
|
change_table :accounts, bulk: true do |t|
|
||||||
add_column :accounts, :display_name, :string, null: false, default: ''
|
t.column :note, :text, null: false, default: ''
|
||||||
add_column :accounts, :uri, :string, null: false, default: ''
|
t.column :display_name, :string, null: false, default: ''
|
||||||
|
t.column :uri, :string, null: false, default: ''
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
class AddMetadataToStatuses < ActiveRecord::Migration[4.2]
|
class AddMetadataToStatuses < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
add_column :statuses, :in_reply_to_id, :integer, null: true
|
change_table(:statuses, bulk: true) do |t|
|
||||||
add_column :statuses, :reblog_of_id, :integer, null: true
|
t.column :in_reply_to_id, :integer, null: true
|
||||||
|
t.column :reblog_of_id, :integer, null: true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class AddDeviseToUsers < ActiveRecord::Migration[4.2]
|
class AddDeviseToUsers < ActiveRecord::Migration[4.2]
|
||||||
def self.up
|
def self.up
|
||||||
change_table(:users) do |t|
|
change_table(:users, bulk: true) do |t|
|
||||||
## Database authenticatable
|
## Database authenticatable
|
||||||
t.string :encrypted_password, null: false, default: ''
|
t.string :encrypted_password, null: false, default: ''
|
||||||
|
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
class AddOwnerToApplication < ActiveRecord::Migration[4.2]
|
class AddOwnerToApplication < ActiveRecord::Migration[4.2]
|
||||||
def change
|
def change
|
||||||
add_column :oauth_applications, :owner_id, :integer, null: true
|
change_table(:oauth_applications, bulk: true) do |t|
|
||||||
add_column :oauth_applications, :owner_type, :string, null: true
|
t.column :owner_id, :integer, null: true
|
||||||
|
t.column :owner_type, :string, null: true
|
||||||
|
end
|
||||||
add_index :oauth_applications, [:owner_id, :owner_type]
|
add_index :oauth_applications, [:owner_id, :owner_type]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
class RemoveOwnerFromApplication < ActiveRecord::Migration[5.0]
|
class RemoveOwnerFromApplication < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
remove_index :oauth_applications, [:owner_id, :owner_type]
|
change_table(:oauth_applications, bulk: true) do |t|
|
||||||
remove_column :oauth_applications, :owner_id, :integer, null: true
|
t.remove_index [:owner_id, :owner_type]
|
||||||
remove_column :oauth_applications, :owner_type, :string, null: true
|
t.remove :owner_id, type: :integer, options: { null: true }
|
||||||
|
t.remove :owner_type, type: :string, options: { null: true }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
class AddConfirmableToUsers < ActiveRecord::Migration[5.0]
|
class AddConfirmableToUsers < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :users, :confirmation_token, :string
|
change_table(:users, bulk: true) do |t|
|
||||||
add_column :users, :confirmed_at, :datetime
|
t.column :confirmation_token, :string
|
||||||
add_column :users, :confirmation_sent_at, :datetime
|
t.column :confirmed_at, :datetime
|
||||||
add_column :users, :unconfirmed_email, :string
|
t.column :confirmation_sent_at, :datetime
|
||||||
|
t.column :unconfirmed_email, :string
|
||||||
|
end
|
||||||
add_index :users, :confirmation_token, unique: true
|
add_index :users, :confirmation_token, unique: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,20 +2,24 @@
|
|||||||
|
|
||||||
class MigrateSettings < ActiveRecord::Migration[4.2]
|
class MigrateSettings < ActiveRecord::Migration[4.2]
|
||||||
def up
|
def up
|
||||||
remove_index :settings, [:target_type, :target_id, :var]
|
change_table(:settings, bulk: true) do |t|
|
||||||
rename_column :settings, :target_id, :thing_id
|
t.remove_index [:target_type, :target_id, :var]
|
||||||
rename_column :settings, :target_type, :thing_type
|
t.rename :target_id, :thing_id
|
||||||
change_column :settings, :thing_id, :integer, null: true, default: nil
|
t.rename :target_type, :thing_type
|
||||||
change_column :settings, :thing_type, :string, null: true, default: nil
|
t.change :thing_id, :integer, null: true, default: nil
|
||||||
add_index :settings, [:thing_type, :thing_id, :var], unique: true
|
t.change :thing_type, :string, null: true, default: nil
|
||||||
|
t.index [:thing_type, :thing_id, :var], unique: true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
remove_index :settings, [:thing_type, :thing_id, :var]
|
change_table(:settings, bulk: true) do |t|
|
||||||
rename_column :settings, :thing_id, :target_id
|
t.remove_index [:thing_type, :thing_id, :var]
|
||||||
rename_column :settings, :thing_type, :target_type
|
t.rename :thing_id, :target_id
|
||||||
change_column :settings, :target_id, :integer, null: false
|
t.rename :thing_type, :target_type
|
||||||
change_column :settings, :target_type, :string, null: false, default: ''
|
t.column :target_id, :integer, null: false
|
||||||
add_index :settings, [:target_type, :target_id, :var], unique: true
|
t.column :target_type, :string, null: false, default: ''
|
||||||
|
t.index [:target_type, :target_id, :var], unique: true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[5.0]
|
class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :users, :encrypted_otp_secret, :string
|
change_table(:users, bulk: true) do |t|
|
||||||
add_column :users, :encrypted_otp_secret_iv, :string
|
t.column :encrypted_otp_secret, :string
|
||||||
add_column :users, :encrypted_otp_secret_salt, :string
|
t.column :encrypted_otp_secret_iv, :string
|
||||||
add_column :users, :consumed_timestep, :integer
|
t.column :encrypted_otp_secret_salt, :string
|
||||||
add_column :users, :otp_required_for_login, :boolean
|
t.column :consumed_timestep, :integer
|
||||||
|
t.column :otp_required_for_login, :boolean
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
class ChangePrimaryKeyToBigintOnStatuses < ActiveRecord::Migration[5.0]
|
class ChangePrimaryKeyToBigintOnStatuses < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
change_column :statuses, :id, :bigint
|
change_table(:statuses, bulk: true) do |t|
|
||||||
change_column :statuses, :reblog_of_id, :bigint
|
t.change :id, :bigint
|
||||||
change_column :statuses, :in_reply_to_id, :bigint
|
t.change :reblog_of_id, :bigint
|
||||||
|
t.change :in_reply_to_id, :bigint
|
||||||
|
end
|
||||||
|
|
||||||
change_column :media_attachments, :status_id, :bigint
|
change_column :media_attachments, :status_id, :bigint
|
||||||
change_column :mentions, :status_id, :bigint
|
change_column :mentions, :status_id, :bigint
|
||||||
|
@ -2,11 +2,15 @@
|
|||||||
|
|
||||||
class AddCounterCaches < ActiveRecord::Migration[5.0]
|
class AddCounterCaches < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :statuses, :favourites_count, :integer, null: false, default: 0
|
change_table(:statuses, bulk: true) do |t|
|
||||||
add_column :statuses, :reblogs_count, :integer, null: false, default: 0
|
t.column :favourites_count, :integer, null: false, default: 0
|
||||||
add_column :accounts, :statuses_count, :integer, null: false, default: 0
|
t.column :reblogs_count, :integer, null: false, default: 0
|
||||||
add_column :accounts, :followers_count, :integer, null: false, default: 0
|
end
|
||||||
add_column :accounts, :following_count, :integer, null: false, default: 0
|
change_table(:accounts, bulk: true) do |t|
|
||||||
|
t.column :statuses_count, :integer, null: false, default: 0
|
||||||
|
t.column :followers_count, :integer, null: false, default: 0
|
||||||
|
t.column :following_count, :integer, null: false, default: 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,13 +2,15 @@
|
|||||||
|
|
||||||
class AddOEmbedToPreviewCards < ActiveRecord::Migration[5.0]
|
class AddOEmbedToPreviewCards < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :preview_cards, :type, :integer, default: 0, null: false
|
change_table(:preview_cards, bulk: true) do |t|
|
||||||
add_column :preview_cards, :html, :text, null: false, default: ''
|
t.column :type, :integer, default: 0, null: false
|
||||||
add_column :preview_cards, :author_name, :string, null: false, default: ''
|
t.column :html, :text, null: false, default: ''
|
||||||
add_column :preview_cards, :author_url, :string, null: false, default: ''
|
t.column :author_name, :string, null: false, default: ''
|
||||||
add_column :preview_cards, :provider_name, :string, null: false, default: ''
|
t.column :author_url, :string, null: false, default: ''
|
||||||
add_column :preview_cards, :provider_url, :string, null: false, default: ''
|
t.column :provider_name, :string, null: false, default: ''
|
||||||
add_column :preview_cards, :width, :integer, default: 0, null: false
|
t.column :provider_url, :string, null: false, default: ''
|
||||||
add_column :preview_cards, :height, :integer, default: 0, null: false
|
t.column :width, :integer, default: 0, null: false
|
||||||
|
t.column :height, :integer, default: 0, null: false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
class ReAddOwnerToApplication < ActiveRecord::Migration[5.0]
|
class ReAddOwnerToApplication < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
add_column :oauth_applications, :owner_id, :integer, null: true
|
change_table(:oauth_applications, bulk: true) do |t|
|
||||||
add_column :oauth_applications, :owner_type, :string, null: true
|
t.column :owner_id, :integer, null: true
|
||||||
|
t.column :owner_type, :string, null: true
|
||||||
|
end
|
||||||
add_index :oauth_applications, [:owner_id, :owner_type]
|
add_index :oauth_applications, [:owner_id, :owner_type]
|
||||||
add_foreign_key :oauth_applications, :users, column: :owner_id, on_delete: :cascade
|
add_foreign_key :oauth_applications, :users, column: :owner_id, on_delete: :cascade
|
||||||
end
|
end
|
||||||
|
@ -3,9 +3,12 @@
|
|||||||
class ChangeLanguageFilterToOptOut < ActiveRecord::Migration[5.0]
|
class ChangeLanguageFilterToOptOut < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
remove_index :users, :allowed_languages
|
remove_index :users, :allowed_languages
|
||||||
remove_column :users, :allowed_languages
|
|
||||||
|
|
||||||
add_column :users, :filtered_languages, :string, array: true, default: [], null: false
|
change_table(:users, bulk: true) do |t|
|
||||||
|
t.remove :allowed_languages
|
||||||
|
t.column :filtered_languages, :string, array: true, default: [], null: false
|
||||||
|
end
|
||||||
|
|
||||||
add_index :users, :filtered_languages, using: :gin
|
add_index :users, :filtered_languages, using: :gin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
class AddDescriptionToSessionActivations < ActiveRecord::Migration[5.1]
|
class AddDescriptionToSessionActivations < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
add_column :session_activations, :user_agent, :string, null: false, default: ''
|
change_table(:session_activations, bulk: true) do |t|
|
||||||
add_column :session_activations, :ip, :inet
|
t.column :user_agent, :string, null: false, default: ''
|
||||||
|
t.column :ip, :inet
|
||||||
|
end
|
||||||
add_foreign_key :session_activations, :users, on_delete: :cascade
|
add_foreign_key :session_activations, :users, on_delete: :cascade
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
class AddActivityPubToAccounts < ActiveRecord::Migration[5.1]
|
class AddActivityPubToAccounts < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
add_column :accounts, :inbox_url, :string, null: false, default: ''
|
change_table(:accounts, bulk: true) do |t|
|
||||||
add_column :accounts, :outbox_url, :string, null: false, default: ''
|
t.column :inbox_url, :string, null: false, default: ''
|
||||||
add_column :accounts, :shared_inbox_url, :string, null: false, default: ''
|
t.column :outbox_url, :string, null: false, default: ''
|
||||||
add_column :accounts, :followers_url, :string, null: false, default: ''
|
t.column :shared_inbox_url, :string, null: false, default: ''
|
||||||
add_column :accounts, :protocol, :integer, null: false, default: 0
|
t.column :followers_url, :string, null: false, default: ''
|
||||||
|
t.column :protocol, :integer, null: false, default: 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddUriToCustomEmojis < ActiveRecord::Migration[5.2]
|
class AddUriToCustomEmojis < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :custom_emojis, :uri, :string
|
safety_assured do
|
||||||
add_column :custom_emojis, :image_remote_url, :string
|
change_table(:custom_emojis, bulk: true) do |t|
|
||||||
|
t.column :uri, :string
|
||||||
|
t.column :image_remote_url, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -15,7 +15,9 @@ class ChangeRelaysEnabled < ActiveRecord::Migration[5.2]
|
|||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
remove_column :relays, :state
|
change_table(:relays, bulk: true) do |t|
|
||||||
add_column :relays, :enabled, :boolean, default: false, null: false
|
t.remove :state
|
||||||
|
t.column :enabled, :boolean, default: false, null: false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,8 +13,12 @@ class AddSilencedAtSuspendedAtToAccounts < ActiveRecord::Migration[5.2]
|
|||||||
end
|
end
|
||||||
|
|
||||||
def up
|
def up
|
||||||
add_column :accounts, :silenced_at, :datetime
|
safety_assured do
|
||||||
add_column :accounts, :suspended_at, :datetime
|
change_table(:accounts, bulk: true) do |t|
|
||||||
|
t.column :silenced_at, :datetime
|
||||||
|
t.column :suspended_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Record suspend date of blocks and silences for users whose limitations match
|
# Record suspend date of blocks and silences for users whose limitations match
|
||||||
# a domain block
|
# a domain block
|
||||||
@ -36,7 +40,9 @@ class AddSilencedAtSuspendedAtToAccounts < ActiveRecord::Migration[5.2]
|
|||||||
Account.where(suspended: false).where.not(suspended_at: nil).in_batches.update_all(suspended: true)
|
Account.where(suspended: false).where.not(suspended_at: nil).in_batches.update_all(suspended: true)
|
||||||
Account.where(silenced: false).where.not(silenced_at: nil).in_batches.update_all(silenced: true)
|
Account.where(silenced: false).where.not(silenced_at: nil).in_batches.update_all(silenced: true)
|
||||||
|
|
||||||
remove_column :accounts, :silenced_at
|
change_table(:accounts, bulk: true) do |t|
|
||||||
remove_column :accounts, :suspended_at
|
t.column :silenced_at, :datetime
|
||||||
|
t.column :suspended_at, :datetime
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,10 +2,14 @@
|
|||||||
|
|
||||||
class AddCapabilitiesToTags < ActiveRecord::Migration[5.2]
|
class AddCapabilitiesToTags < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :tags, :usable, :boolean
|
safety_assured do
|
||||||
add_column :tags, :trendable, :boolean
|
change_table(:tags, bulk: true) do |t|
|
||||||
add_column :tags, :listable, :boolean
|
t.column :usable, :boolean
|
||||||
add_column :tags, :reviewed_at, :datetime
|
t.column :trendable, :boolean
|
||||||
add_column :tags, :requested_review_at, :datetime
|
t.column :listable, :boolean
|
||||||
|
t.column :reviewed_at, :datetime
|
||||||
|
t.column :requested_review_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddCommentsToDomainBlocks < ActiveRecord::Migration[5.2]
|
class AddCommentsToDomainBlocks < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :domain_blocks, :private_comment, :text
|
safety_assured do
|
||||||
add_column :domain_blocks, :public_comment, :text
|
change_table(:domain_blocks, bulk: true) do |t|
|
||||||
|
t.column :private_comment, :text
|
||||||
|
t.column :public_comment, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddLastStatusAtToTags < ActiveRecord::Migration[5.2]
|
class AddLastStatusAtToTags < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :tags, :last_status_at, :datetime
|
safety_assured do
|
||||||
add_column :tags, :last_trend_at, :datetime
|
change_table(:tags, bulk: true) do |t|
|
||||||
|
t.column :last_status_at, :datetime
|
||||||
|
t.column :last_trend_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddMaxScoreToTags < ActiveRecord::Migration[5.2]
|
class AddMaxScoreToTags < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :tags, :max_score, :float
|
safety_assured do
|
||||||
add_column :tags, :max_score_at, :datetime
|
change_table(:tags, bulk: true) do |t|
|
||||||
|
t.column :max_score, :float
|
||||||
|
t.column :max_score_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,8 +3,12 @@
|
|||||||
class AddStorageSchemaVersion < ActiveRecord::Migration[5.2]
|
class AddStorageSchemaVersion < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :preview_cards, :image_storage_schema_version, :integer
|
add_column :preview_cards, :image_storage_schema_version, :integer
|
||||||
add_column :accounts, :avatar_storage_schema_version, :integer
|
safety_assured do
|
||||||
add_column :accounts, :header_storage_schema_version, :integer
|
change_table(:accounts, bulk: true) do |t|
|
||||||
|
t.column :avatar_storage_schema_version, :integer
|
||||||
|
t.column :header_storage_schema_version, :integer
|
||||||
|
end
|
||||||
|
end
|
||||||
add_column :media_attachments, :file_storage_schema_version, :integer
|
add_column :media_attachments, :file_storage_schema_version, :integer
|
||||||
add_column :custom_emojis, :image_storage_schema_version, :integer
|
add_column :custom_emojis, :image_storage_schema_version, :integer
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddSignInTokenToUsers < ActiveRecord::Migration[5.2]
|
class AddSignInTokenToUsers < ActiveRecord::Migration[5.2]
|
||||||
def change
|
def change
|
||||||
add_column :users, :sign_in_token, :string
|
safety_assured do
|
||||||
add_column :users, :sign_in_token_sent_at, :datetime
|
change_table(:users, bulk: true) do |t|
|
||||||
|
t.column :sign_in_token, :string
|
||||||
|
t.column :sign_in_token_sent_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
class AddLanguageToPreviewCards < ActiveRecord::Migration[6.1]
|
class AddLanguageToPreviewCards < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :preview_cards, :language, :string
|
safety_assured do
|
||||||
add_column :preview_cards, :max_score, :float
|
change_table(:preview_cards, bulk: true) do |t|
|
||||||
add_column :preview_cards, :max_score_at, :datetime
|
t.column :language, :string
|
||||||
|
t.column :max_score, :float
|
||||||
|
t.column :max_score_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,16 +8,24 @@ class AddCategoryToReports < ActiveRecord::Migration[6.1]
|
|||||||
disable_ddl_transaction!
|
disable_ddl_transaction!
|
||||||
|
|
||||||
def up
|
def up
|
||||||
safety_assured { add_column_with_default :reports, :category, :int, default: 0, allow_null: false }
|
safety_assured do
|
||||||
add_column :reports, :action_taken_at, :datetime
|
add_column_with_default :reports, :category, :int, default: 0, allow_null: false
|
||||||
add_column :reports, :rule_ids, :bigint, array: true
|
change_table(:reports, bulk: true) do |t|
|
||||||
safety_assured { execute 'UPDATE reports SET action_taken_at = updated_at WHERE action_taken = TRUE' }
|
t.column :action_taken_at, :datetime
|
||||||
|
t.column :rule_ids, :bigint, array: true
|
||||||
|
end
|
||||||
|
execute 'UPDATE reports SET action_taken_at = updated_at WHERE action_taken = TRUE'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
safety_assured { execute 'UPDATE reports SET action_taken = TRUE WHERE action_taken_at IS NOT NULL' }
|
safety_assured do
|
||||||
remove_column :reports, :category
|
execute 'UPDATE reports SET action_taken = TRUE WHERE action_taken_at IS NOT NULL'
|
||||||
remove_column :reports, :action_taken_at
|
remove_column :reports, :category
|
||||||
remove_column :reports, :rule_ids
|
change_table(:reports, bulk: true) do |t|
|
||||||
|
t.column :action_taken_at, :datetime
|
||||||
|
t.column :rule_ids, :bigint, array: true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
class AddTrendableToAccounts < ActiveRecord::Migration[6.1]
|
class AddTrendableToAccounts < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :accounts, :trendable, :boolean
|
safety_assured do
|
||||||
add_column :accounts, :reviewed_at, :datetime
|
change_table(:accounts, bulk: true) do |t|
|
||||||
add_column :accounts, :requested_review_at, :datetime
|
t.column :trendable, :boolean
|
||||||
|
t.column :reviewed_at, :datetime
|
||||||
|
t.column :requested_review_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddIpsToEmailDomainBlocks < ActiveRecord::Migration[6.1]
|
class AddIpsToEmailDomainBlocks < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :email_domain_blocks, :ips, :inet, array: true
|
safety_assured do
|
||||||
add_column :email_domain_blocks, :last_refresh_at, :datetime
|
change_table(:email_domain_blocks, bulk: true) do |t|
|
||||||
|
t.column :ips, :inet, array: true
|
||||||
|
t.column :last_refresh_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
class AddLastUsedAtToOauthAccessTokens < ActiveRecord::Migration[6.1]
|
class AddLastUsedAtToOauthAccessTokens < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :oauth_access_tokens, :last_used_at, :datetime
|
safety_assured do
|
||||||
add_column :oauth_access_tokens, :last_used_ip, :inet
|
change_table(:oauth_access_tokens, bulk: true) do |t|
|
||||||
|
t.column :last_used_at, :datetime
|
||||||
|
t.column :last_used_ip, :inet
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,9 +2,13 @@
|
|||||||
|
|
||||||
class AddOrderedMediaAttachmentIdsToStatusEdits < ActiveRecord::Migration[6.1]
|
class AddOrderedMediaAttachmentIdsToStatusEdits < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :status_edits, :ordered_media_attachment_ids, :bigint, array: true
|
safety_assured do
|
||||||
add_column :status_edits, :media_descriptions, :text, array: true
|
change_table(:status_edits, bulk: true) do |t|
|
||||||
add_column :status_edits, :poll_options, :string, array: true
|
t.column :ordered_media_attachment_ids, :bigint, array: true
|
||||||
add_column :status_edits, :sensitive, :boolean
|
t.column :media_descriptions, :text, array: true
|
||||||
|
t.column :poll_options, :string, array: true
|
||||||
|
t.column :sensitive, :boolean
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
class AddHumanIdentifierToAdminActionLogs < ActiveRecord::Migration[6.1]
|
class AddHumanIdentifierToAdminActionLogs < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
add_column :admin_action_logs, :human_identifier, :string
|
safety_assured do
|
||||||
add_column :admin_action_logs, :route_param, :string
|
change_table(:admin_action_logs, bulk: true) do |t|
|
||||||
add_column :admin_action_logs, :permalink, :string
|
t.column :human_identifier, :string
|
||||||
|
t.column :route_param, :string
|
||||||
|
t.column :permalink, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user