File tree Expand file tree Collapse file tree 3 files changed +1
-32
lines changed
apps/core/src/migration/version Expand file tree Collapse file tree 3 files changed +1
-32
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,6 @@ export default (async function v0840Fix1(db: Db) {
6
6
try {
7
7
const notesCollection = db . collection ( 'notes' )
8
8
9
- // 移除 isPublished 字段
10
- await notesCollection . updateMany (
11
- { } ,
12
- { $unset : { isPublished : '' } } ,
13
- { upsert : false } ,
14
- )
15
-
16
9
// 将 hide 字段重命名为 isPublished, 同时将true与false互换
17
10
await notesCollection . updateMany (
18
11
{ } ,
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ export default (async function v0840Fix2(db: Db) {
6
6
try {
7
7
const postsCollection = db . collection ( 'posts' )
8
8
9
- // 将 isPublished 字段全部设置为 true
10
9
await postsCollection . updateMany (
11
10
{ } ,
12
11
{ $set : { isPublished : true } } ,
Original file line number Diff line number Diff line change 1
1
// patch for version lower than v8.4.0
2
- // 本次migration会向posts和notes表中添加一个isPublished字段,默认值为true
3
- import type { Db } from 'mongodb'
4
2
5
- export default ( async function v0840 ( db : Db ) {
6
- try {
7
- const postsCollection = db . collection ( 'posts' )
8
- const notesCollection = db . collection ( 'notes' )
9
-
10
- // 添加 isPublished 字段到 posts 集合
11
- await postsCollection . updateMany (
12
- { } ,
13
- { $set : { isPublished : true } } ,
14
- { upsert : false } ,
15
- )
16
-
17
- // 添加 isPublished 字段到 notes 集合
18
- await notesCollection . updateMany (
19
- { } ,
20
- { $set : { isPublished : true } } ,
21
- { upsert : false } ,
22
- )
23
- } catch ( error ) {
24
- console . error ( 'Migration to v8.4.0 failed:' , error )
25
- }
26
- } )
3
+ export default ( async function v0840 ( ) { } )
You can’t perform that action at this time.
0 commit comments