`bos db repair --mode history-reset` drops the shared journal for every workspace and re-applies migrations into `public`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- postgresql, typescript
調査の方向性
Start with services/db/repair.ts, then read db/core.ts and the workspace drizzle.config.ts files to confirm how the shared journal and schema are selected. Compare the repair path with runMigrations and its search path handling. Done means repair preserves other workspaces' migration history and applies or safely refuses migrations for the target workspace schema.
索引モデルが issue の本文から書いたものです。
説明
Environment
everything-dev 2.0.0-rc.27
Where
services/db/repair.ts:
-
Journal reset is not slug-scoped — `dist/services/db/repair.mjs:60`:
```ts
await pool.query(`DROP TABLE IF EXISTS ${journalRef}`);
```
The journal table is shared by all workspaces on one database (`getMigrationStorage` default; `PER_PLUGIN_ISOLATION = false` in `db/core.ts`), so "reset the migration history" for plugin A silently wipes the recorded history of every other plugin and the api workspace on that database. -
Reapply targets the wrong schema — the fix path re-runs drizzle-kit migrate via each workspace's `drizzle.config.ts`. That config maps the journal schema/table but has no notion of the v2 data schema, so drizzle-kit creates/validates tables in the session `search_path` (`public`). The v2 runtime (`runMigrations`) scopes plugin tables into `plugin_` (it even strips `"public".` prefixes from migration SQL and runs under `search_path="plugin_,public"`).
Consequences (observed on nearbuilders.org during a v1→v2 consolidation)
- On a v1 per-plugin DB that boots with `drift-safe-repair` (runtime checks `plugin_`, finds journal hashes + tables in `public` only): repair cannot fix the boot — the runtime error persists, and repair may instead recreate tables in `public`.
- On a healthy consolidated database: repair destroys every workspace's journal and can spray `public`-schema copies of plugin tables.
Suggested fix
- Make the journal operation slug-scoped under the shared-journal topology: delete only the target workspace's migration hashes (the history rows whose hashes the workspace's local migrations reference).
- Re-apply migrations under the workspace's data schema (`search_path = plugin_,public`), matching what the runtime runner does — or reuse `runMigrations` directly.
- Alternatively: refuse to run against the shared-journal topology and point users at re-baseline/consolidation tooling.
Note: because the runtime runner is drift-tolerant (the tables-present preflight records migration hashes as applied without replaying DDL), an actual journal-only reset usually self-heals on next boot when tables exist in the right schema — a `public`-targeted drizzle-kit pass adds risk without fixing anything.
- 主要言語
- TypeScript
- スター
- 5
- フォーク
- 3
- 平均マージ
- 9時間 37分
- マージ済み PR(30日)
- 157
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NEARBuilders/everything-dev のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
NEARBuilders/everything-dev#628 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NEARBuilders/everything-dev#400 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
NEARBuilders/everything-dev#667 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
NEARBuilders/everything-dev#666 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
NEARBuilders/everything-dev#665 ·
メンテナーはふだん 1 日以内に返信
NEARBuilders/everything-dev の issue をすべて見る
似ている issue
-
area:cli bug P4
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug from-studio
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
esengine/DeepSeek-Reasonix#14868 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
linxiv-dev/linXiv#384 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
scope:core type:security
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
mailgun/mailgun.js#544 ·