1
0
forked from mirror/misskey

Merge pull request #2568 from syuilo/fix-drop-index

Fix drop index
This commit is contained in:
syuilo 2018-09-01 19:13:49 +09:00 committed by GitHub
commit 70ac668474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,12 @@ import * as mongo from 'mongodb';
import db from '../db/mongodb'; import db from '../db/mongodb';
const Stats = db.get<IStats>('stats'); const Stats = db.get<IStats>('stats');
Stats.dropIndex({ date: -1 } as any); // 後方互換性のため
// 後方互換性のため
Stats.dropIndex({ date: -1 } as any).catch((e: mongo.MongoError) => {
if (e.code !== 27) throw e;
});
Stats.createIndex({ span: -1, date: -1 }, { unique: true }); Stats.createIndex({ span: -1, date: -1 }, { unique: true });
export default Stats; export default Stats;