Fix: 過去のマイグレーションミスで生じたと思われる余分なテーブルとカラムを削除 (#470)

This commit is contained in:
KMY(雪あすか) 2024-01-17 11:34:02 +09:00 committed by GitHub
parent 4c2675be41
commit b0ce0a8dab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 15 deletions

View file

@ -13,7 +13,6 @@
# updated_at :datetime not null
# emoji_reactions :string
# emoji_reactions_count :integer default(0), not null
# test :integer default(0), not null
# emoji_reaction_accounts_count :integer default(0), not null
# status_referred_by_count :integer default(0), not null
#

View file

@ -0,0 +1,14 @@
# frozen_string_literal: true
class RemoveUnusedTable < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
def up
safety_assured do
execute('DROP TABLE IF EXISTS account_groups CASCADE')
execute('ALTER TABLE status_stats DROP COLUMN IF EXISTS test')
end
end
def down; end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
ActiveRecord::Schema[7.1].define(version: 2024_01_17_021025) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -50,15 +50,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
t.index ["account_id", "domain"], name: "index_account_domain_blocks_on_account_id_and_domain", unique: true
end
create_table "account_groups", force: :cascade do |t|
t.bigint "account_id", null: false
t.bigint "group_account_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_account_groups_on_account_id"
t.index ["group_account_id"], name: "index_account_groups_on_group_account_id"
end
create_table "account_migrations", force: :cascade do |t|
t.bigint "account_id"
t.string "acct", default: "", null: false
@ -1200,7 +1191,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
t.datetime "updated_at", precision: nil, null: false
t.string "emoji_reactions"
t.integer "emoji_reactions_count", default: 0, null: false
t.integer "test", default: 0, null: false
t.integer "emoji_reaction_accounts_count", default: 0, null: false
t.integer "status_referred_by_count", default: 0, null: false
t.index ["status_id"], name: "index_status_stats_on_status_id", unique: true
@ -1427,7 +1417,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
add_foreign_key "account_conversations", "conversations", on_delete: :cascade
add_foreign_key "account_deletion_requests", "accounts", on_delete: :cascade
add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade
add_foreign_key "account_groups", "accounts", on_delete: :cascade
add_foreign_key "account_migrations", "accounts", column: "target_account_id", on_delete: :nullify
add_foreign_key "account_migrations", "accounts", on_delete: :cascade
add_foreign_key "account_moderation_notes", "accounts"

View file

@ -77,9 +77,10 @@ namespace :dangerous do
20230308061833
20230223102416
20230222232121
20240117021025
)
# Removed: account_groups
target_tables = %w(
account_groups
antennas
antenna_accounts
antenna_domains
@ -144,7 +145,7 @@ namespace :dangerous do
%w(status_stats emoji_reactions_count),
%w(status_stats emoji_reaction_accounts_count),
%w(status_stats status_referred_by_count),
%w(status_stats test),
# Removed: status_stats test
]
target_indices = %w(
index_statuses_on_url