2.5.1.js 719 B

1234567891011121314151617181920212223
  1. exports.up = async knex => {
  2. await knex('authentication').where('isEnabled', false).del()
  3. await knex.schema
  4. .alterTable('authentication', table => {
  5. table.dropColumn('isEnabled')
  6. table.integer('order').unsigned().notNullable().defaultTo(0)
  7. table.string('strategyKey').notNullable().defaultTo('')
  8. table.string('displayName').notNullable().defaultTo('')
  9. })
  10. // Fix pre-2.5 strategies
  11. const strategies = await knex('authentication')
  12. let idx = 1
  13. for (const strategy of strategies) {
  14. await knex('authentication').where('key', strategy.key).update({
  15. strategyKey: strategy.key,
  16. order: (strategy.key === 'local') ? 0 : idx++
  17. })
  18. }
  19. }
  20. exports.down = knex => { }