Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
@ -80,7 +80,7 @@ class IdsToBigints < ActiveRecord::Migration[5.1]
|
||||
say 'This migration has some sections that can be safely interrupted'
|
||||
say 'and restarted later, and will tell you when those are occurring.'
|
||||
say ''
|
||||
say 'For more information, see https://github.com/tootsuite/mastodon/pull/5088'
|
||||
say 'For more information, see https://github.com/mastodon/mastodon/pull/5088'
|
||||
|
||||
10.downto(1) do |i|
|
||||
say "Continuing in #{i} second#{i == 1 ? '' : 's'}...", true
|
||||
|
12
db/migrate/20220824233535_create_status_trends.rb
Normal file
12
db/migrate/20220824233535_create_status_trends.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class CreateStatusTrends < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :status_trends do |t|
|
||||
t.references :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
|
||||
t.references :account, null: false, foreign_key: { on_delete: :cascade }
|
||||
t.float :score, null: false, default: 0
|
||||
t.integer :rank, null: false, default: 0
|
||||
t.boolean :allowed, null: false, default: false
|
||||
t.string :language
|
||||
end
|
||||
end
|
||||
end
|
11
db/migrate/20221006061337_create_preview_card_trends.rb
Normal file
11
db/migrate/20221006061337_create_preview_card_trends.rb
Normal file
@ -0,0 +1,11 @@
|
||||
class CreatePreviewCardTrends < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :preview_card_trends do |t|
|
||||
t.references :preview_card, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true }
|
||||
t.float :score, null: false, default: 0
|
||||
t.integer :rank, null: false, default: 0
|
||||
t.boolean :allowed, null: false, default: false
|
||||
t.string :language
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddBlurhashToSiteUploads < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :site_uploads, :blurhash, :string
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
class AddIndexFeaturedTagsOnAccountIdAndTagId < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
duplicates = FeaturedTag.connection.select_all('SELECT string_agg(id::text, \',\') AS ids FROM featured_tags GROUP BY account_id, tag_id HAVING count(*) > 1').to_ary
|
||||
|
||||
duplicates.each do |row|
|
||||
FeaturedTag.where(id: row['ids'].split(',')[0...-1]).destroy_all
|
||||
end
|
||||
|
||||
add_index :featured_tags, [:account_id, :tag_id], unique: true, algorithm: :concurrently
|
||||
remove_index :featured_tags, [:account_id], algorithm: :concurrently
|
||||
end
|
||||
|
||||
def down
|
||||
add_index :featured_tags, [:account_id], algorithm: :concurrently
|
||||
remove_index :featured_tags, [:account_id, :tag_id], unique: true, algorithm: :concurrently
|
||||
end
|
||||
end
|
17
db/migrate/20221025171544_add_index_ip_blocks_on_ip.rb
Normal file
17
db/migrate/20221025171544_add_index_ip_blocks_on_ip.rb
Normal file
@ -0,0 +1,17 @@
|
||||
class AddIndexIpBlocksOnIp < ActiveRecord::Migration[6.1]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
duplicates = IpBlock.connection.select_all('SELECT string_agg(id::text, \',\') AS ids FROM ip_blocks GROUP BY ip HAVING count(*) > 1').to_ary
|
||||
|
||||
duplicates.each do |row|
|
||||
IpBlock.where(id: row['ids'].split(',')[0...-1]).destroy_all
|
||||
end
|
||||
|
||||
add_index :ip_blocks, :ip, unique: true, algorithm: :concurrently
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :ip_blocks, :ip, unique: true
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user