-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Labels
Description
I get the following message whenever I run autoupdate:
"error":{"message":"The operation failed because an index or statistics with name 'principalId_NONCLUSTERED_ASC_idx' already exists on table 'dbo.RoleMapping'.","stack":"RequestError: The operation failed because an index or statistics with name 'principalId_NONCLUSTERED_ASC_idx' already exists on table 'dbo.RoleMapping'
The table name doesn't matter, cause the error is thrown on different tables every time. The first run is fine, but whenever I kill the app and restart it, this error is thrown.
Here's the code I'm using in boot/auto-update.js
'use strict';
module.exports = function(app, done) {
var logger = require('../../server/logger');
var log = logger.child({module: 'auto-update'});
var mssql = app.dataSources.mssql;
mssql.autoupdate(function(err) {
if (err) {
log.error({error: err}, 'Error autoupdating DB');
return done(err);
}
log.info('Database updation complete.');
done();
});
};