mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
added additions_to_attachments
fixment
This commit is contained in:
parent
754068006b
commit
acd0dae11c
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