This commit is contained in:
		
							parent
							
								
									996292cd55
								
							
						
					
					
						commit
						96fb6e491f
					
				| @ -50,7 +50,7 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics: | ||||
|           WHERE date_trunc('day', media_attachments.created_at)::date = axis.period | ||||
|             AND #{account_domain_sql(params[:include_subdomains])} | ||||
|         ) | ||||
|         SELECT COALESCE(SUM(size), 0)::bigint FROM new_media_attachments | ||||
|         SELECT COALESCE(SUM(size), 0) FROM new_media_attachments | ||||
|       ) AS value | ||||
|       FROM ( | ||||
|         SELECT generate_series(date_trunc('day', :start_at::timestamp)::date, date_trunc('day', :end_at::timestamp)::date, interval '1 day') AS period | ||||
|  | ||||
| @ -1,42 +0,0 @@ | ||||
| # frozen_string_literal: true | ||||
| 
 | ||||
| require_relative '../../lib/mastodon/migration_helpers' | ||||
| 
 | ||||
| class ConvertFileSizeColumnsToBigInt < 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(:bigint) | ||||
|   end | ||||
| 
 | ||||
|   def down | ||||
|     migrate_columns(:integer) | ||||
|   end | ||||
| end | ||||
							
								
								
									
										16
									
								
								db/schema.rb
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								db/schema.rb
									
									
									
									
									
								
							| @ -166,11 +166,11 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.string "url" | ||||
|     t.string "avatar_file_name" | ||||
|     t.string "avatar_content_type" | ||||
|     t.bigint "avatar_file_size" | ||||
|     t.integer "avatar_file_size" | ||||
|     t.datetime "avatar_updated_at", precision: nil | ||||
|     t.string "header_file_name" | ||||
|     t.string "header_content_type" | ||||
|     t.bigint "header_file_size" | ||||
|     t.integer "header_file_size" | ||||
|     t.datetime "header_updated_at", precision: nil | ||||
|     t.string "avatar_remote_url" | ||||
|     t.boolean "locked", default: false, null: false | ||||
| @ -368,7 +368,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.string "domain" | ||||
|     t.string "image_file_name" | ||||
|     t.string "image_content_type" | ||||
|     t.bigint "image_file_size" | ||||
|     t.integer "image_file_size" | ||||
|     t.datetime "image_updated_at", precision: nil | ||||
|     t.datetime "created_at", precision: nil, null: false | ||||
|     t.datetime "updated_at", precision: nil, null: false | ||||
| @ -558,7 +558,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.datetime "updated_at", precision: nil, null: false | ||||
|     t.string "data_file_name" | ||||
|     t.string "data_content_type" | ||||
|     t.bigint "data_file_size" | ||||
|     t.integer "data_file_size" | ||||
|     t.datetime "data_updated_at", precision: nil | ||||
|     t.bigint "account_id", null: false | ||||
|     t.boolean "overwrite", default: false, null: false | ||||
| @ -635,7 +635,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.bigint "status_id" | ||||
|     t.string "file_file_name" | ||||
|     t.string "file_content_type" | ||||
|     t.bigint "file_file_size" | ||||
|     t.integer "file_file_size" | ||||
|     t.datetime "file_updated_at", precision: nil | ||||
|     t.string "remote_url", default: "", null: false | ||||
|     t.datetime "created_at", precision: nil, null: false | ||||
| @ -651,7 +651,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.integer "file_storage_schema_version" | ||||
|     t.string "thumbnail_file_name" | ||||
|     t.string "thumbnail_content_type" | ||||
|     t.bigint "thumbnail_file_size" | ||||
|     t.integer "thumbnail_file_size" | ||||
|     t.datetime "thumbnail_updated_at", precision: nil | ||||
|     t.string "thumbnail_remote_url" | ||||
|     t.index ["account_id", "status_id"], name: "index_media_attachments_on_account_id_and_status_id", order: { status_id: :desc } | ||||
| @ -855,7 +855,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.string "description", default: "", null: false | ||||
|     t.string "image_file_name" | ||||
|     t.string "image_content_type" | ||||
|     t.bigint "image_file_size" | ||||
|     t.integer "image_file_size" | ||||
|     t.datetime "image_updated_at", precision: nil | ||||
|     t.integer "type", default: 0, null: false | ||||
|     t.text "html", default: "", null: false | ||||
| @ -993,7 +993,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_22_161611) do | ||||
|     t.string "var", default: "", null: false | ||||
|     t.string "file_file_name" | ||||
|     t.string "file_content_type" | ||||
|     t.bigint "file_file_size" | ||||
|     t.integer "file_file_size" | ||||
|     t.datetime "file_updated_at", precision: nil | ||||
|     t.json "meta" | ||||
|     t.datetime "created_at", precision: nil, null: false | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user