`bos db repair --mode history-reset` drops the shared journal for every workspace and re-applies migrations into `public`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- postgresql, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 5
- Fork
- 3
- Merge trung bình
- 9 giờ 37 phút
- Pull request đã merge (30 ngày)
- 157
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NEARBuilders/everything-dev
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
NEARBuilders/everything-dev#628 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NEARBuilders/everything-dev#400 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
NEARBuilders/everything-dev#667 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
NEARBuilders/everything-dev#666 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
NEARBuilders/everything-dev#665 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NEARBuilders/everything-dev
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BeOS .json missingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mihaip/infinite-mac#475 ·
-
Let TypeScript accept an initial object in ReactiveDictCó thể đã có người làm @yograj-vijay-yadav đã nhận hôm nay. Đang mởbug good first issue help wanted workshop
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
meteor/meteor#14919 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
marmelab/atomic-crm#401 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
account: profile
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 5 ngày