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
|
29
db/schema.rb
29
db/schema.rb
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
ActiveRecord::Schema.define(version: 2022_10_25_171544) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@ -442,7 +442,7 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
t.datetime "last_status_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_featured_tags_on_account_id"
|
||||
t.index ["account_id", "tag_id"], name: "index_featured_tags_on_account_id_and_tag_id", unique: true
|
||||
t.index ["tag_id"], name: "index_featured_tags_on_tag_id"
|
||||
end
|
||||
|
||||
@ -521,6 +521,7 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
t.inet "ip", default: "0.0.0.0", null: false
|
||||
t.integer "severity", default: 0, null: false
|
||||
t.text "comment", default: "", null: false
|
||||
t.index ["ip"], name: "index_ip_blocks_on_ip", unique: true
|
||||
end
|
||||
|
||||
create_table "list_accounts", force: :cascade do |t|
|
||||
@ -735,6 +736,15 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
t.index ["domain"], name: "index_preview_card_providers_on_domain", unique: true
|
||||
end
|
||||
|
||||
create_table "preview_card_trends", force: :cascade do |t|
|
||||
t.bigint "preview_card_id", null: false
|
||||
t.float "score", default: 0.0, null: false
|
||||
t.integer "rank", default: 0, null: false
|
||||
t.boolean "allowed", default: false, null: false
|
||||
t.string "language"
|
||||
t.index ["preview_card_id"], name: "index_preview_card_trends_on_preview_card_id", unique: true
|
||||
end
|
||||
|
||||
create_table "preview_cards", force: :cascade do |t|
|
||||
t.string "url", default: "", null: false
|
||||
t.string "title", default: "", null: false
|
||||
@ -857,6 +867,7 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
t.json "meta"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "blurhash"
|
||||
t.index ["var"], name: "index_site_uploads_on_var", unique: true
|
||||
end
|
||||
|
||||
@ -895,6 +906,17 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
t.index ["status_id"], name: "index_status_stats_on_status_id", unique: true
|
||||
end
|
||||
|
||||
create_table "status_trends", force: :cascade do |t|
|
||||
t.bigint "status_id", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.float "score", default: 0.0, null: false
|
||||
t.integer "rank", default: 0, null: false
|
||||
t.boolean "allowed", default: false, null: false
|
||||
t.string "language"
|
||||
t.index ["account_id"], name: "index_status_trends_on_account_id"
|
||||
t.index ["status_id"], name: "index_status_trends_on_status_id", unique: true
|
||||
end
|
||||
|
||||
create_table "statuses", id: :bigint, default: -> { "timestamp_id('statuses'::text)" }, force: :cascade do |t|
|
||||
t.string "uri"
|
||||
t.text "text", default: "", null: false
|
||||
@ -1174,6 +1196,7 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
add_foreign_key "poll_votes", "polls", on_delete: :cascade
|
||||
add_foreign_key "polls", "accounts", on_delete: :cascade
|
||||
add_foreign_key "polls", "statuses", on_delete: :cascade
|
||||
add_foreign_key "preview_card_trends", "preview_cards", on_delete: :cascade
|
||||
add_foreign_key "report_notes", "accounts", on_delete: :cascade
|
||||
add_foreign_key "report_notes", "reports", on_delete: :cascade
|
||||
add_foreign_key "reports", "accounts", column: "action_taken_by_account_id", name: "fk_bca45b75fd", on_delete: :nullify
|
||||
@ -1188,6 +1211,8 @@ ActiveRecord::Schema.define(version: 2022_08_29_192658) do
|
||||
add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade
|
||||
add_foreign_key "status_pins", "statuses", on_delete: :cascade
|
||||
add_foreign_key "status_stats", "statuses", on_delete: :cascade
|
||||
add_foreign_key "status_trends", "accounts", on_delete: :cascade
|
||||
add_foreign_key "status_trends", "statuses", on_delete: :cascade
|
||||
add_foreign_key "statuses", "accounts", column: "in_reply_to_account_id", name: "fk_c7fa917661", on_delete: :nullify
|
||||
add_foreign_key "statuses", "accounts", name: "fk_9bda1543f7", on_delete: :cascade
|
||||
add_foreign_key "statuses", "statuses", column: "in_reply_to_id", on_delete: :nullify
|
||||
|
Reference in New Issue
Block a user