Skip to content

fix(backend): legacy退避テーブルを削除しmigrationの主キー衝突を解消 - #92

Merged
mattyatea merged 4 commits into
developfrom
codex/fix-legacy-emoji-migration
Oct 24, 2026
Merged

mattyatea merged 4 commits into
developfrom
codex/fix-legacy-emoji-migration

Conversation

@mattyatea

@mattyatea mattyatea commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

TypeAny移行で退避したlegacyテーブル4種類を、通常のmigration実行で削除します。

  • legacy_emoji_request
  • legacy_note_schedule
  • legacy_note_unread
  • legacy_inbox_rule

主キー衝突を解消する修復migrationを、AlignSchema1791103688453 の直前に追加します。
通常migrationの最後には DropLegacyTables で4種類を削除します。
pnpm migrate・Docker起動スクリプト・既存migrationは変更しません。
専用DataSourceと先行実行コマンドは不要です。

Why

旧形式の emoji_request を退避しても、主キーインデックス名 PK_3c74521e048dc744f0c7eb65f4a が残り、AlignSchemaの主キー作成が 42P07 で停止します。
未使用のタイムスタンプ 1791103688452 に修復migrationを追加し、既存の 1791103688453 の直前で名前を解放します。
既存履歴の書き換えや実行処理の特別扱いは行いません。
すでにAlignSchemaを適用したDBでも、TypeORMが未実行の修復migrationを認識することを確認しています。

本番の稼働中15 DBを読み取り専用で確認し、legacyは4種類・54テーブルでした。
現行コードからの利用と外部キー参照はありませんでした。
旧未読記録だけは5 DBに合計14行あり、これも削除対象に含みます。
その他のlegacyはすべて0行でした。
legacy全体の削除はユーザーの依頼に基づきます。

Additional info (optional)

  • PASS — PostgreSQL 18の回帰テスト4件。未適用DBを通常migration 1回で修復、適用済みDBで新規修復を実行、全4種類の削除と現行申請の保持、外部参照がある場合の削除拒否、再実行を確認。
  • PASS — 既存DB相当の衝突状態と新規DBの両方で通常の pnpm --filter backend migrate が成功。両方ともlegacyテーブル0件・check-migrations のpending DDL 0件。
  • PASS — backend build、SPDX・locale safety・差分検査。ESLint対象変更はなし。
  • テスト — 標準PG環境変数を設定して node --test packages/backend/test/migration/legacy-cleanup.test.mjs。
  • CASCADE とワイルドカード削除は使いません。対象4種類を明示し、外部参照があれば停止します。
  • 削除は不可逆です。down() は復元できると誤認させず、明示的にエラーにします。
  • 本番のcleanupは未実行です。現在のk8sは既存アプリを保持してNode.jsのみ26.12.1にした互換イメージで稼働しています。
  • CHANGELOG候補 — Fix: legacy退避テーブルを削除し、既存DBでmigrationが主キー名衝突により停止する問題を修正。

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

Copilot AI balanced review requested due to automatic review settings October 22, 2026 04:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: Type4ny-Project/Misskey/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2302754-a508-44e9-86a7-0168a477ac14
📥 Commits

Reviewing files that changed from the base of the PR and between a6dd47b and 3c722ac.

📒 Files selected for processing: 3
  • packages/backend/migration/1791103688452-drop-legacy-emoji-request.js
  • packages/backend/migration/1792643998126-drop-legacy-tables.js
  • packages/backend/test/migration/legacy-cleanup.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

このPRによるapi.jsonの差分
差分はありません。
Get diff files from Workflow Page

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🖥 Frontend Diagnostics Report

(No significant changes)

View details

Requests by resource type
Type Requests Encoded bytes
Base Head Δ Base Head Δ
Document 2 2 0 34 KB 34 KB 0 B
Script 152 152 0 2.4 MB 2.4 MB $\color{orange}{\text{+36 B}}$
Stylesheet 63 63 0 320 KB 320 KB 0 B
Fetch 28 28 0 47 KB 47 KB 0 B
Image 9 9 0 238 KB 238 KB 0 B
Font 2 2 0 129 KB 129 KB 0 B
Other 9 9 0 421 KB 421 KB 0 B
V8 heap snapshot statistics
Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 12 MB
± 8.7 KB
12 MB
± 2.4 KB
$\text{-4.6 KB}$
$\text{-0\%}$
9 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 3 MB 3 MB $\text{+5.7 KB}$ 1.2 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 1.3 MB 1.3 MB $\text{+296 B}$ 401 B
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 122 KB 122 KB 0 B 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 0 B 0 B 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 0 B 0 B 0 B 0 B
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 2.2 MB 2.2 MB $\text{+656 B}$ 408 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 5.5 MB 5.5 MB $\text{-4.4 KB}$ 13 KB

Download representative heap snapshot: base / head

📦 Bundle Stats

Chunk size diff (0 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 6.1 MB 6.1 MB $\text{+18 B}$ $\text{+0\%}$
(other generated chunks) 2.3 MB 2.3 MB $\text{+18 B}$ $\text{+0\%}$
Startup chunk size (0 updated, 0 added, 0 removed)
Chunk Base Head Δ Δ (%)
(total) 958 KB 958 KB $\text{+18 B}$ $\text{+0\%}$
(other generated chunks) 884 KB 884 KB $\text{+18 B}$ $\text{+0\%}$
(other) 74 KB 74 KB 0 B 0%

Startup chunks are the Vite entry for src/_boot_.ts and its static imports.

Bundles Modules Entries Imports Size
Static Dynamic Rendered Gzip Brotli
Base 509 3,031 22 11,274 366 11 MB 3 MB 2.6 MB
Head 509 3,031 22 11,274 366 11 MB 3 MB 2.6 MB
Δ 0 0 0 0 0 $\text{+18 B}$ $\text{-33 B}$ $\text{-16 B}$
Δ (%) 0% 0% 0% 0% 0% $\text{+0\%}$ $\text{-0\%}$ $\text{-0\%}$

Open treemap HTML

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

⚙️ Backend Diagnostics Report

Memory: After GC

(No significant changes)

V8 Heap Snapshot Statistics

Metric @ Base @ Head Δ MAD
$\color{gray}{\rule{8pt}{8pt}}$ Total 90 MB
± 13 KB
90 MB
± 6.7 KB
$\text{+3.4 KB}$
$\text{+0\%}$
15 KB
$\color{orange}{\rule{8pt}{8pt}}$ Code 26 MB 26 MB $\text{-3.5 KB}$ 4.6 KB
$\color{red}{\rule{8pt}{8pt}}$ Strings 31 MB 31 MB $\text{+600 B}$ 684 B
$\color{cyan}{\rule{8pt}{8pt}}$ JS arrays 4.9 MB 4.9 MB 0 B 0 B
$\color{green}{\rule{8pt}{8pt}}$ Typed arrays 566 KB 566 KB 0 B 0 B
$\color{yellow}{\rule{8pt}{8pt}}$ System objects 2.3 MB 2.3 MB $\text{-6.2 KB}$ 1.9 KB
$\color{violet}{\rule{8pt}{8pt}}$ Other JS objs 25 MB 25 MB $\text{-248 B}$ 258 B
$\color{pink}{\rule{8pt}{8pt}}$ Other non-JS objs 39 KB 39 KB 0 B 0 B

Download representative heap snapshot: base / head

@mattyatea mattyatea changed the title fix(backend): legacy絵文字申請の主キー衝突でmigrationが停止する問題を修正 fix(backend): legacy退避テーブルを削除しmigrationの主キー衝突を解消 Oct 22, 2026
@mattyatea
mattyatea merged commit 7b3c63c into develop Oct 24, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants