rubberguppe/db/setup.js

22 lines
576 B
JavaScript
Raw Normal View History

2019-09-15 02:49:33 +00:00
const utils = require('../utils')
const crypto = require('crypto')
module.exports = async function dbSetup (db, domain) {
await db.collection('streams').createIndex({
_target: 1,
_id: -1,
})
await db.collection('streams').createIndex({
actor: 1,
_id: -1,
})
2019-09-15 02:49:33 +00:00
const dummyUser = await utils.createLocalActor('dummy', 'Person')
await db.collection('objects').findOneAndReplace(
{preferredUsername: 'dummy'},
2019-09-15 02:49:33 +00:00
dummyUser,
{
upsert: true,
returnOriginal: false,
}
)
}