fix custompages index issue

merge-requests/218/head
Thomas Lynch 3 years ago
parent 57bb23ae55
commit 523fbac0d7
  1. 2
      gulpfile.js
  2. 1
      migrations/index.js
  3. 2
      migrations/migration-0.0.17.js
  4. 11
      migrations/migration-0.0.19.js
  5. 2
      package.json

@ -117,7 +117,7 @@ async function wipe() {
await Posts.db.dropIndexes()
await Modlogs.db.dropIndexes()
await CustomPages.db.dropIndexes()
await CustomPages.db.createIndex({ 'board': 1, 'url': 1 }, { unique: true })
await CustomPages.db.createIndex({ 'board': 1, 'page': 1 }, { unique: true })
await Modlogs.db.createIndex({ 'board': 1 })
await Files.db.createIndex({ 'count': 1 })
await Bans.db.createIndex({ 'ip.single': 1 , 'board': 1 })

@ -19,4 +19,5 @@ module.exports = {
'0.0.16': require(__dirname+'/migration-0.0.16.js'), //separate tph/pph triggers
'0.0.17': require(__dirname+'/migration-0.0.17.js'), //add custompages collection
'0.0.18': require(__dirname+'/migration-0.0.18.js'), //disable onion file posting to disable anonymizer file posting
'0.0.19': require(__dirname+'/migration-0.0.19.js'), //fix incorrect index causing duplicate key error
}

@ -3,5 +3,5 @@
module.exports = async(db, redis) => {
console.log('add collection for board custompages');
await db.createCollection('custompages');
await db.collection('custompages').createIndex({ 'board': 1, 'url': 1 }, { unique: true });
await db.collection('custompages').createIndex({ 'board': 1, 'page': 1 }, { unique: true });
};

@ -0,0 +1,11 @@
'use strict';
module.exports = async(db, redis) => {
console.log('fixing index for custompages');
try {
await db.collection('custompages').dropIndex('board_1_url_1');
} catch (e) {
// didnt have the bad index
}
await db.collection('custompages').createIndex({ 'board': 1, 'page': 1 }, { unique: true });
};

@ -1,7 +1,7 @@
{
"name": "jschan",
"version": "0.0.1",
"migrateVersion": "0.0.18",
"migrateVersion": "0.0.19",
"description": "",
"main": "server.js",
"dependencies": {

Loading…
Cancel
Save