mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
added additions_to_attachments
fixment
This commit is contained in:
parent
615874d740
commit
3e84c4bea8
26
packages/server/src/fixments/additions_to_attachments.js
Normal file
26
packages/server/src/fixments/additions_to_attachments.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { Post } from "../models"
|
||||
import DBManager from "../classes/DbManager"
|
||||
|
||||
async function main() {
|
||||
const dbManager = new DBManager()
|
||||
await dbManager.connect()
|
||||
|
||||
const posts = await Post.find({}).catch(() => false)
|
||||
|
||||
for await (let post of posts) {
|
||||
let postData = post.toObject()
|
||||
|
||||
if (postData["additions"]) {
|
||||
// transform additions to attachments
|
||||
postData["attachments"] = postData["additions"]
|
||||
}
|
||||
|
||||
post.attachments = postData["attachments"]
|
||||
|
||||
await post.save()
|
||||
}
|
||||
|
||||
console.log("Done!")
|
||||
}
|
||||
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user