Merge remote-tracking branch 'tootsuite/main' into custom/quote
# Conflicts: # app/services/fetch_link_card_service.rb
This commit is contained in:
@@ -17,6 +17,21 @@ class FixAccountsUniqueIndex < ActiveRecord::Migration[5.2]
|
||||
belongs_to :account, inverse_of: :stream_entries
|
||||
end
|
||||
|
||||
class Status < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
class Mention < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
class StatusPin < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account
|
||||
end
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
|
@@ -1,6 +1,46 @@
|
||||
class RemoveFauxRemoteAccountDuplicates < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
class StreamEntry < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account, inverse_of: :stream_entries
|
||||
end
|
||||
|
||||
class Status < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account, inverse_of: :statuses
|
||||
has_many :favourites, inverse_of: :status, dependent: :destroy
|
||||
has_many :mentions, dependent: :destroy, inverse_of: :status
|
||||
end
|
||||
|
||||
class Favourite < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account, inverse_of: :favourites
|
||||
belongs_to :status, inverse_of: :favourites
|
||||
end
|
||||
|
||||
class Mention < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account, inverse_of: :mentions
|
||||
belongs_to :status
|
||||
end
|
||||
|
||||
class Notification < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
belongs_to :account, optional: true
|
||||
belongs_to :from_account, class_name: 'Account', optional: true
|
||||
belongs_to :activity, polymorphic: true, optional: true
|
||||
end
|
||||
|
||||
class Account < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
has_many :stream_entries, inverse_of: :account, dependent: :destroy
|
||||
has_many :statuses, inverse_of: :account, dependent: :destroy
|
||||
has_many :favourites, inverse_of: :account, dependent: :destroy
|
||||
has_many :mentions, inverse_of: :account, dependent: :destroy
|
||||
has_many :notifications, inverse_of: :account, dependent: :destroy
|
||||
end
|
||||
|
||||
def up
|
||||
local_domain = Rails.configuration.x.local_domain
|
||||
|
||||
|
@@ -1,4 +1,9 @@
|
||||
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 }
|
||||
end
|
||||
|
||||
def up
|
||||
Account.create!(id: -99, actor_type: 'Application', locked: true, username: Rails.configuration.x.local_domain)
|
||||
end
|
||||
|
@@ -1,4 +1,8 @@
|
||||
class UpdatePtLocales < ActiveRecord::Migration[5.2]
|
||||
class User < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
end
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
|
5
db/migrate/20210616214526_create_user_ips.rb
Normal file
5
db/migrate/20210616214526_create_user_ips.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class CreateUserIps < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_view :user_ips
|
||||
end
|
||||
end
|
5
db/migrate/20210904215403_add_edited_at_to_statuses.rb
Normal file
5
db/migrate/20210904215403_add_edited_at_to_statuses.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddEditedAtToStatuses < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :statuses, :edited_at, :datetime
|
||||
end
|
||||
end
|
13
db/migrate/20210908220918_create_status_edits.rb
Normal file
13
db/migrate/20210908220918_create_status_edits.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateStatusEdits < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :status_edits do |t|
|
||||
t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }
|
||||
t.belongs_to :account, null: true, foreign_key: { on_delete: :nullify }
|
||||
t.text :text, null: false, default: ''
|
||||
t.text :spoiler_text, null: false, default: ''
|
||||
t.boolean :media_attachments_changed, null: false, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
12
db/migrate/20211031031021_create_preview_card_providers.rb
Normal file
12
db/migrate/20211031031021_create_preview_card_providers.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class CreatePreviewCardProviders < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :preview_card_providers do |t|
|
||||
t.string :domain, null: false, default: '', index: { unique: true }
|
||||
t.attachment :icon
|
||||
t.boolean :trendable
|
||||
t.datetime :reviewed_at
|
||||
t.datetime :requested_review_at
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,7 @@
|
||||
class AddLanguageToPreviewCards < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :preview_cards, :language, :string
|
||||
add_column :preview_cards, :max_score, :float
|
||||
add_column :preview_cards, :max_score_at, :datetime
|
||||
end
|
||||
end
|
@@ -0,0 +1,5 @@
|
||||
class AddTrendableToPreviewCards < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :preview_cards, :trendable, :boolean
|
||||
end
|
||||
end
|
@@ -0,0 +1,5 @@
|
||||
class AddLinkTypeToPreviewCards < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :preview_cards, :link_type, :int
|
||||
end
|
||||
end
|
@@ -0,0 +1,24 @@
|
||||
class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
reapplication_follow_recommendations_v2 do
|
||||
drop_view :account_summaries, materialized: true
|
||||
create_view :account_summaries, version: 2, materialized: { no_data: true }
|
||||
safety_assured { add_index :account_summaries, :account_id, unique: true }
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
reapplication_follow_recommendations_v2 do
|
||||
drop_view :account_summaries, materialized: true
|
||||
create_view :account_summaries, version: 1, materialized: { no_data: true }
|
||||
safety_assured { add_index :account_summaries, :account_id, unique: true }
|
||||
end
|
||||
end
|
||||
|
||||
def reapplication_follow_recommendations_v2
|
||||
drop_view :follow_recommendations, materialized: true
|
||||
yield
|
||||
create_view :follow_recommendations, version: 2, materialized: { no_data: true }
|
||||
safety_assured { add_index :follow_recommendations, :account_id, unique: true }
|
||||
end
|
||||
end
|
21
db/migrate/20211231080958_add_category_to_reports.rb
Normal file
21
db/migrate/20211231080958_add_category_to_reports.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddCategoryToReports < ActiveRecord::Migration[6.1]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { add_column_with_default :reports, :category, :int, default: 0, allow_null: false }
|
||||
add_column :reports, :action_taken_at, :datetime
|
||||
add_column :reports, :rule_ids, :bigint, array: true
|
||||
safety_assured { execute 'UPDATE reports SET action_taken_at = updated_at WHERE action_taken = TRUE' }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { execute 'UPDATE reports SET action_taken = TRUE WHERE action_taken_at IS NOT NULL' }
|
||||
remove_column :reports, :category
|
||||
remove_column :reports, :action_taken_at
|
||||
remove_column :reports, :rule_ids
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
class RemoveMentionsStatusIdIndex < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
remove_index :mentions, name: :mentions_status_id_index if index_exists?(:mentions, :status_id, name: :mentions_status_id_index)
|
||||
end
|
||||
|
||||
def down
|
||||
# As this index should not exist and is a duplicate of another index, do not re-create it
|
||||
end
|
||||
end
|
@@ -0,0 +1,6 @@
|
||||
class AddReportIdToAccountWarnings < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
safety_assured { add_reference :account_warnings, :report, foreign_key: { on_delete: :cascade }, index: false }
|
||||
add_column :account_warnings, :status_ids, :string, array: true
|
||||
end
|
||||
end
|
21
db/migrate/20220115125341_fix_account_warning_actions.rb
Normal file
21
db/migrate/20220115125341_fix_account_warning_actions.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class FixAccountWarningActions < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured do
|
||||
execute 'UPDATE account_warnings SET action = 1000 WHERE action = 1'
|
||||
execute 'UPDATE account_warnings SET action = 2000 WHERE action = 2'
|
||||
execute 'UPDATE account_warnings SET action = 3000 WHERE action = 3'
|
||||
execute 'UPDATE account_warnings SET action = 4000 WHERE action = 4'
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
execute 'UPDATE account_warnings SET action = 1 WHERE action = 1000'
|
||||
execute 'UPDATE account_warnings SET action = 2 WHERE action = 2000'
|
||||
execute 'UPDATE account_warnings SET action = 3 WHERE action = 3000'
|
||||
execute 'UPDATE account_warnings SET action = 4 WHERE action = 4000'
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,7 @@
|
||||
class AddDeletedAtIndexOnStatuses < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :statuses, :deleted_at, where: 'deleted_at IS NOT NULL', algorithm: :concurrently
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user