2019-09-15 02:49:33 +00:00
|
|
|
const utils = require('../utils')
|
|
|
|
const crypto = require('crypto')
|
|
|
|
|
2019-09-15 00:00:26 +00:00
|
|
|
module.exports = async function dbSetup (db, domain) {
|
2019-09-17 01:58:32 +00:00
|
|
|
// inbox
|
2019-09-15 00:00:26 +00:00
|
|
|
await db.collection('streams').createIndex({
|
2019-09-13 01:03:04 +00:00
|
|
|
_target: 1,
|
|
|
|
_id: -1,
|
|
|
|
})
|
2019-09-17 01:58:32 +00:00
|
|
|
// outbox
|
2019-09-15 00:00:26 +00:00
|
|
|
await db.collection('streams').createIndex({
|
|
|
|
actor: 1,
|
|
|
|
_id: -1,
|
|
|
|
})
|
2019-09-17 01:58:32 +00:00
|
|
|
// object lookup
|
|
|
|
await db.collection('objects').createIndex({
|
|
|
|
id: 1
|
|
|
|
})
|
2019-09-15 02:49:33 +00:00
|
|
|
const dummyUser = await utils.createLocalActor('dummy', 'Person')
|
2019-09-15 00:00:26 +00:00
|
|
|
await db.collection('objects').findOneAndReplace(
|
|
|
|
{preferredUsername: 'dummy'},
|
2019-09-15 02:49:33 +00:00
|
|
|
dummyUser,
|
2019-09-15 00:00:26 +00:00
|
|
|
{
|
|
|
|
upsert: true,
|
|
|
|
returnOriginal: false,
|
|
|
|
}
|
|
|
|
)
|
2019-09-13 01:03:04 +00:00
|
|
|
}
|