Regression: Create migration to fix index issue at boot (#24289)

pull/24131/head^2
Kevin Aleman 3 years ago committed by GitHub
parent 1acd18196a
commit a39b0e880f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      server/startup/migrations/index.ts
  2. 16
      server/startup/migrations/v253.ts

@ -76,4 +76,5 @@ import './v249';
import './v250';
import './v251';
import './v252';
import './v253';
import './xrun';

@ -0,0 +1,16 @@
import { addMigration } from '../../lib/migrations';
import CannedResponse from '../../../ee/app/models/server/raw/CannedResponse';
// This will remove old indexes and re-create the new one
addMigration({
version: 253,
async up() {
try {
await CannedResponse.col.dropIndex('shortcut_1');
await CannedResponse.col.createIndex({ shortcut: 1 }, { unique: true });
} catch (e) {
// should we allow the error to kill the app? Or just log it?
console.error('Cannot drop indexes', e);
}
},
});
Loading…
Cancel
Save