forked from mastodon/mastodon
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
db/migrate/20240509220635_revert_media_file_size_column_to_big_int.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../lib/mastodon/migration_helpers' | ||
|
||
class RevertMediaFileSizeColumnToBigInt < ActiveRecord::Migration[7.1] | ||
include Mastodon::MigrationHelpers | ||
|
||
TABLE_COLUMN_MAPPING = [ | ||
[:accounts, :avatar_file_size], | ||
[:accounts, :header_file_size], | ||
[:custom_emojis, :image_file_size], | ||
[:imports, :data_file_size], | ||
[:media_attachments, :file_file_size], | ||
[:media_attachments, :thumbnail_file_size], | ||
[:preview_cards, :image_file_size], | ||
[:site_uploads, :file_file_size], | ||
].freeze | ||
|
||
disable_ddl_transaction! | ||
|
||
def migrate_columns(to_type) | ||
TABLE_COLUMN_MAPPING.each do |column_parts| | ||
table, column = column_parts | ||
|
||
# Skip this if we're resuming and already did this one. | ||
next if column_for(table, column).sql_type == to_type.to_s | ||
|
||
safety_assured do | ||
change_column_type_concurrently table, column, to_type | ||
cleanup_concurrent_column_type_change table, column | ||
end | ||
end | ||
end | ||
|
||
def up | ||
migrate_columns(:integer) | ||
end | ||
|
||
def down | ||
migrate_columns(:integer) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters