mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
19 lines
634 B
JavaScript
19 lines
634 B
JavaScript
|
var commands = require('../../schema').commands,
|
||
|
db = require('../../db'),
|
||
|
|
||
|
table = 'clients',
|
||
|
column = 'secret';
|
||
|
|
||
|
module.exports = function dropUniqueOnClientsSecret(logInfo) {
|
||
|
return db.knex.schema.hasTable(table).then(function (exists) {
|
||
|
if (exists) {
|
||
|
return commands.getIndexes(table).then(function (indexes) {
|
||
|
if (indexes.indexOf(table + '_' + column + '_unique') > -1) {
|
||
|
logInfo('Dropping unique on: ' + table + '.' + column);
|
||
|
return commands.dropUnique(table, column);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
};
|