Merge remote-tracking branch 'parent/main' into upstream-20241216
This commit is contained in:
commit
3784ad273c
555 changed files with 7564 additions and 3363 deletions
|
@ -1,9 +1,16 @@
|
|||
inherit_from: ../../.rubocop.yml
|
||||
|
||||
Naming/VariableNumber:
|
||||
CheckSymbols: false
|
||||
# Below are all enabled as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
||||
# TODO: Delete this file and move above config to base naming config
|
||||
|
||||
# Enabled here as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
||||
Rails/CreateTableWithTimestamps:
|
||||
Include:
|
||||
- '*.rb'
|
||||
|
||||
Rails/ThreeStateBooleanColumn:
|
||||
Include:
|
||||
- '*.rb'
|
||||
|
||||
Rails/ReversibleMigration:
|
||||
Include:
|
||||
- '*.rb'
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddAdminToUsers < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :users, :admin, :boolean, default: false
|
||||
add_column :users, :admin, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddSensitiveToStatuses < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :statuses, :sensitive, :boolean, default: false
|
||||
add_column :statuses, :sensitive, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddRejectMediaToDomainBlocks < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :domain_blocks, :reject_media, :boolean
|
||||
add_column :domain_blocks, :reject_media, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[5.0]
|
|||
t.column :encrypted_otp_secret_iv, :string
|
||||
t.column :encrypted_otp_secret_salt, :string
|
||||
t.column :consumed_timestep, :integer
|
||||
t.column :otp_required_for_login, :boolean
|
||||
t.column :otp_required_for_login, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RemoveDevices < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
def up
|
||||
drop_table :devices if table_exists?(:devices)
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
add_column :statuses, :reply, :boolean, nil: false, default: false
|
||||
add_column :statuses, :reply, :boolean, default: false # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class AddTypeToMediaAttachments < ActiveRecord::Migration[5.0]
|
||||
class MigrationMediaAttachment < ApplicationRecord
|
||||
self.table_name = :media_attachments
|
||||
enum type: [:image, :gifv, :video]
|
||||
enum :type, [:image, :gifv, :video]
|
||||
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
|
||||
VIDEO_MIME_TYPES = ['video/webm', 'video/mp4'].freeze
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class CreateImports < ActiveRecord::Migration[5.0]
|
|||
create_table :imports do |t|
|
||||
t.integer :account_id, null: false
|
||||
t.integer :type, null: false
|
||||
t.boolean :approved
|
||||
t.boolean :approved # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
class FixNullBooleans < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
safety_assured do
|
||||
change_column_default :domain_blocks, :reject_media, false
|
||||
change_column_default :domain_blocks, :reject_media, false # rubocop:disable Rails/ReversibleMigration
|
||||
change_column_null :domain_blocks, :reject_media, false, false
|
||||
|
||||
change_column_default :imports, :approved, false
|
||||
change_column_default :imports, :approved, false # rubocop:disable Rails/ReversibleMigration
|
||||
change_column_null :imports, :approved, false, false
|
||||
|
||||
change_column_null :statuses, :sensitive, false, false
|
||||
|
@ -14,7 +14,7 @@ class FixNullBooleans < ActiveRecord::Migration[5.1]
|
|||
|
||||
change_column_null :users, :admin, false, false
|
||||
|
||||
change_column_default :users, :otp_required_for_login, false
|
||||
change_column_default :users, :otp_required_for_login, false # rubocop:disable Rails/ReversibleMigration
|
||||
change_column_null :users, :otp_required_for_login, false, false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddLocalToStatuses < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :statuses, :local, :boolean, null: true, default: nil
|
||||
add_column :statuses, :local, :boolean, null: true, default: nil # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class AddIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migrat
|
|||
|
||||
def change
|
||||
safety_assured do
|
||||
add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
|
||||
add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
remove_index :statuses, [:account_id, :id], name: :index_statuses_on_account_id_id
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class RevertIndexChangeOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecor
|
|||
|
||||
def change
|
||||
safety_assured do
|
||||
add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 unless index_name_exists?(:statuses, 'index_statuses_20180106')
|
||||
add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 unless index_name_exists?(:statuses, 'index_statuses_20180106') # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
|
||||
# These index may not exists (see migration 20180514130000)
|
||||
|
|
|
@ -21,7 +21,7 @@ class MigrateAccountConversations < ActiveRecord::Migration[5.2]
|
|||
belongs_to :account, class_name: 'MigrationAccount'
|
||||
has_many :mentions, dependent: :destroy, inverse_of: :status, class_name: 'MigrationMention', foreign_key: :status_id
|
||||
scope :local, -> { where(local: true).or(where(uri: nil)) }
|
||||
enum visibility: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4 }, _suffix: :visibility
|
||||
enum :visibility, { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4 }, suffix: :visibility
|
||||
has_many :active_mentions, -> { active }, class_name: 'MigrationMention', inverse_of: :status, foreign_key: :status_id
|
||||
end
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddDiscoverableToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :discoverable, :boolean
|
||||
add_column :accounts, :discoverable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddByModeratorToTombstone < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :tombstones, :by_moderator, :boolean
|
||||
add_column :tombstones, :by_moderator, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class AddSilencedAtSuspendedAtToAccounts < ActiveRecord::Migration[5.2]
|
|||
|
||||
class DomainBlock < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
enum severity: [:silence, :suspend, :noop]
|
||||
enum :severity, [:silence, :suspend, :noop]
|
||||
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain
|
||||
end
|
||||
|
|
|
@ -4,9 +4,11 @@ class AddCapabilitiesToTags < ActiveRecord::Migration[5.2]
|
|||
def change
|
||||
safety_assured do
|
||||
change_table(:tags, bulk: true) do |t|
|
||||
# rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.column :usable, :boolean
|
||||
t.column :trendable, :boolean
|
||||
t.column :listable, :boolean
|
||||
# rubocop:enable Rails/ThreeStateBooleanColumn
|
||||
t.column :reviewed_at, :datetime
|
||||
t.column :requested_review_at, :datetime
|
||||
end
|
||||
|
|
|
@ -4,12 +4,12 @@ class UpdateStatusesIndex < ActiveRecord::Migration[5.2]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], where: 'deleted_at IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20190820 }
|
||||
remove_index :statuses, name: :index_statuses_20180106
|
||||
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], where: 'deleted_at IS NULL', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20190820 } # rubocop:disable Naming/VariableNumber
|
||||
remove_index :statuses, name: :index_statuses_20180106 # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 }
|
||||
remove_index :statuses, name: :index_statuses_20190820
|
||||
safety_assured { add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 } # rubocop:disable Naming/VariableNumber
|
||||
remove_index :statuses, name: :index_statuses_20190820 # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,10 +4,10 @@ class AddLocalIndexToStatuses < ActiveRecord::Migration[5.2]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
|
||||
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :statuses, name: :index_statuses_local_20190824
|
||||
remove_index :statuses, name: :index_statuses_local_20190824 # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddHideCollectionsToAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :accounts, :hide_collections, :boolean
|
||||
add_column :accounts, :hide_collections, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,10 +4,10 @@ class AddPublicIndexToStatuses < ActiveRecord::Migration[5.2]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_index :statuses, [:id, :account_id], name: :index_statuses_public_20200119, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
|
||||
add_index :statuses, [:id, :account_id], name: :index_statuses_public_20200119, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :statuses, name: :index_statuses_public_20200119
|
||||
remove_index :statuses, name: :index_statuses_public_20200119 # rubocop:disable Naming/VariableNumber
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddForwardedToReports < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :reports, :forwarded, :boolean
|
||||
add_column :reports, :forwarded, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class CreateLoginActivities < ActiveRecord::Migration[6.1]
|
|||
t.belongs_to :user, null: false, foreign_key: { on_delete: :cascade }
|
||||
t.string :authentication_method
|
||||
t.string :provider
|
||||
t.boolean :success
|
||||
t.boolean :success # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.string :failure_reason
|
||||
t.inet :ip
|
||||
t.string :user_agent
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddSkipSignInTokenToUsers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :users, :skip_sign_in_token, :boolean
|
||||
add_column :users, :skip_sign_in_token, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class CreatePreviewCardProviders < ActiveRecord::Migration[6.1]
|
|||
create_table :preview_card_providers do |t|
|
||||
t.string :domain, null: false, default: '', index: { unique: true }
|
||||
t.attachment :icon
|
||||
t.boolean :trendable
|
||||
t.boolean :trendable # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.datetime :reviewed_at
|
||||
t.datetime :requested_review_at
|
||||
t.timestamps
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddTrendableToPreviewCards < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :preview_cards, :trendable, :boolean
|
||||
add_column :preview_cards, :trendable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class AddTrendableToAccounts < ActiveRecord::Migration[6.1]
|
|||
def change
|
||||
safety_assured do
|
||||
change_table(:accounts, bulk: true) do |t|
|
||||
t.column :trendable, :boolean
|
||||
t.column :trendable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.column :reviewed_at, :datetime
|
||||
t.column :requested_review_at, :datetime
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddTrendableToStatuses < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :statuses, :trendable, :boolean
|
||||
add_column :statuses, :trendable, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class AddOrderedMediaAttachmentIdsToStatusEdits < ActiveRecord::Migration[6.1]
|
|||
t.column :ordered_media_attachment_ids, :bigint, array: true
|
||||
t.column :media_descriptions, :text, array: true
|
||||
t.column :poll_options, :string, array: true
|
||||
t.column :sensitive, :boolean
|
||||
t.column :sensitive, :boolean # rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class ChangeCanonicalEmailBlocksNullable < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
safety_assured { change_column :canonical_email_blocks, :reference_account_id, :bigint, null: true, default: nil }
|
||||
safety_assured { change_column :canonical_email_blocks, :reference_account_id, :bigint, null: true, default: nil } # rubocop:disable Rails/ReversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,10 @@ class CreateSeveredRelationships < ActiveRecord::Migration[7.0]
|
|||
t.integer :direction, null: false
|
||||
|
||||
# Those attributes are carried over from the `follows` table
|
||||
# rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
t.boolean :show_reblogs
|
||||
t.boolean :notify
|
||||
# rubocop:enable Rails/ThreeStateBooleanColumn
|
||||
t.string :languages, array: true
|
||||
|
||||
t.timestamps
|
||||
|
|
14
db/migrate/20241123224956_create_terms_of_services.rb
Normal file
14
db/migrate/20241123224956_create_terms_of_services.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateTermsOfServices < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
create_table :terms_of_services do |t|
|
||||
t.text :text, null: false, default: ''
|
||||
t.text :changelog, null: false, default: ''
|
||||
t.datetime :published_at
|
||||
t.datetime :notification_sent_at
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountPinAccountColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_pins
|
||||
WHERE account_id IS NULL
|
||||
OR target_account_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured do
|
||||
change_column_null :account_pins, :account_id, false
|
||||
change_column_null :account_pins, :target_account_id, false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
change_column_null :account_pins, :account_id, true
|
||||
change_column_null :account_pins, :target_account_id, true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountAliasColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_aliases
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured { change_column_null :account_aliases, :account_id, false }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { change_column_null :account_aliases, :account_id, true }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountDeletionRequestColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_deletion_requests
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured { change_column_null :account_deletion_requests, :account_id, false }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { change_column_null :account_deletion_requests, :account_id, true }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAccountDomainBlockColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM account_domain_blocks
|
||||
WHERE account_id IS NULL
|
||||
OR domain IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured do
|
||||
change_column_null :account_domain_blocks, :account_id, false
|
||||
change_column_null :account_domain_blocks, :domain, false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
change_column_null :account_domain_blocks, :account_id, true
|
||||
change_column_null :account_domain_blocks, :domain, true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAdminActionLogColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM admin_action_logs
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured { change_column_null :admin_action_logs, :account_id, false }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { change_column_null :admin_action_logs, :account_id, true }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAnnouncementMuteColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM announcement_mutes
|
||||
WHERE account_id IS NULL
|
||||
OR announcement_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured do
|
||||
change_column_null :announcement_mutes, :account_id, false
|
||||
change_column_null :announcement_mutes, :announcement_id, false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
change_column_null :announcement_mutes, :account_id, true
|
||||
change_column_null :announcement_mutes, :announcement_id, true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToAnnouncementReactionColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM announcement_reactions
|
||||
WHERE account_id IS NULL
|
||||
OR announcement_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured do
|
||||
change_column_null :announcement_reactions, :account_id, false
|
||||
change_column_null :announcement_reactions, :announcement_id, false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured do
|
||||
change_column_null :announcement_reactions, :account_id, true
|
||||
change_column_null :announcement_reactions, :announcement_id, true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToCustomFilterColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM custom_filters
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured { change_column_null :custom_filters, :account_id, false }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { change_column_null :custom_filters, :account_id, true }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToScheduledStatusColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM scheduled_statuses
|
||||
WHERE account_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured { change_column_null :scheduled_statuses, :account_id, false }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { change_column_null :scheduled_statuses, :account_id, true }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToUserInviteRequestColumns < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM user_invite_requests
|
||||
WHERE user_id IS NULL
|
||||
SQL
|
||||
|
||||
safety_assured { change_column_null :user_invite_requests, :user_id, false }
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured { change_column_null :user_invite_requests, :user_id, true }
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@ class RemoveSuspendedSilencedAccountFields < ActiveRecord::Migration[5.2]
|
|||
|
||||
class DomainBlock < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
enum severity: [:silence, :suspend, :noop]
|
||||
enum :severity, [:silence, :suspend, :noop]
|
||||
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class FillAccountSuspensionOrigin < ActiveRecord::Migration[5.2]
|
|||
class MigrationAccount < ApplicationRecord
|
||||
self.table_name = :accounts
|
||||
scope :suspended, -> { where.not(suspended_at: nil) }
|
||||
enum suspension_origin: { local: 0, remote: 1 }, _prefix: true
|
||||
enum :suspension_origin, { local: 0, remote: 1 }, prefix: true
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
39
db/schema.rb
39
db/schema.rb
|
@ -10,12 +10,12 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_12_12_154346) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "account_aliases", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.string "acct", default: "", null: false
|
||||
t.string "uri", default: "", null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
|
@ -36,17 +36,17 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "account_deletion_requests", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["account_id"], name: "index_account_deletion_requests_on_account_id"
|
||||
end
|
||||
|
||||
create_table "account_domain_blocks", force: :cascade do |t|
|
||||
t.string "domain"
|
||||
t.string "domain", null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.bigint "account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.index ["account_id", "domain"], name: "index_account_domain_blocks_on_account_id_and_domain", unique: true
|
||||
end
|
||||
|
||||
|
@ -82,8 +82,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "account_pins", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "target_account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "target_account_id", null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["account_id", "target_account_id"], name: "index_account_pins_on_account_id_and_target_account_id", unique: true
|
||||
|
@ -220,7 +220,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "admin_action_logs", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.string "action", default: "", null: false
|
||||
t.string "target_type"
|
||||
t.bigint "target_id"
|
||||
|
@ -234,8 +234,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "announcement_mutes", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "announcement_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "announcement_id", null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["account_id", "announcement_id"], name: "index_announcement_mutes_on_account_id_and_announcement_id", unique: true
|
||||
|
@ -243,8 +243,8 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "announcement_reactions", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "announcement_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "announcement_id", null: false
|
||||
t.string "name", default: "", null: false
|
||||
t.bigint "custom_emoji_id"
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
|
@ -542,7 +542,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "custom_filters", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.datetime "expires_at", precision: nil
|
||||
t.text "phrase", default: "", null: false
|
||||
t.string "context", default: [], null: false, array: true
|
||||
|
@ -1236,7 +1236,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "scheduled_statuses", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.bigint "account_id", null: false
|
||||
t.datetime "scheduled_at", precision: nil
|
||||
t.jsonb "params"
|
||||
t.index ["account_id"], name: "index_scheduled_statuses_on_account_id"
|
||||
|
@ -1474,6 +1474,15 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
t.index "lower((name)::text) text_pattern_ops", name: "index_tags_on_name_lower_btree", unique: true
|
||||
end
|
||||
|
||||
create_table "terms_of_services", force: :cascade do |t|
|
||||
t.text "text", default: "", null: false
|
||||
t.text "changelog", default: "", null: false
|
||||
t.datetime "published_at"
|
||||
t.datetime "notification_sent_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "tombstones", force: :cascade do |t|
|
||||
t.bigint "account_id"
|
||||
t.string "uri", null: false
|
||||
|
@ -1492,7 +1501,7 @@ ActiveRecord::Schema[7.2].define(version: 2024_12_08_232829) do
|
|||
end
|
||||
|
||||
create_table "user_invite_requests", force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.bigint "user_id", null: false
|
||||
t.text "text"
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue