File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
src/lib/migrations/routines Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { collections } from "$lib/server/database" ;
2
+ import type { Migration } from "." ;
3
+ import { ObjectId } from "mongodb" ;
4
+
5
+ const migration : Migration = {
6
+ _id : new ObjectId ( "000000000000000000000010" ) ,
7
+ name : "Update reports with assistantId to use contentId" ,
8
+ up : async ( ) => {
9
+ await collections . reports . updateMany (
10
+ {
11
+ assistantId : { $exists : true , $ne : null } ,
12
+ } ,
13
+ [
14
+ {
15
+ $set : {
16
+ object : "assistant" ,
17
+ contentId : "$assistantId" ,
18
+ } ,
19
+ } ,
20
+ {
21
+ $unset : "assistantId" ,
22
+ } ,
23
+ ]
24
+ ) ;
25
+ return true ;
26
+ } ,
27
+ } ;
28
+
29
+ export default migration ;
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import trimMessageUpdates from "./06-trim-message-updates";
10
10
import resetTools from "./07-reset-tools-in-settings" ;
11
11
import updateFeaturedToReview from "./08-update-featured-to-review" ;
12
12
import deleteEmptyConversations from "./09-delete-empty-conversations" ;
13
+ import updateReportsAssistantId from "./10-update-reports-assistantid" ;
14
+
13
15
export interface Migration {
14
16
_id : ObjectId ;
15
17
name : string ;
@@ -30,4 +32,5 @@ export const migrations: Migration[] = [
30
32
resetTools ,
31
33
updateFeaturedToReview ,
32
34
deleteEmptyConversations ,
35
+ updateReportsAssistantId ,
33
36
] ;
You can’t perform that action at this time.
0 commit comments