mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
refs #6301 - Replace builder & automated database upgrade with a set of explicit tasks - Ensure the tasks can only happen if they need to - Remove some duplicate code between fixture & db upgrades (more to do) - Add tests
18 lines
634 B
JavaScript
18 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);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|