0040-video-nsfw.ts 685 B

123456789101112131415161718192021222324252627282930313233
  1. import * as Sequelize from 'sequelize'
  2. import * as Promise from 'bluebird'
  3. import { Migration } from '../../models/migrations'
  4. function up (utils: {
  5. transaction: Sequelize.Transaction,
  6. queryInterface: Sequelize.QueryInterface,
  7. sequelize: Sequelize.Sequelize
  8. }): Promise<void> {
  9. const q = utils.queryInterface
  10. const data = {
  11. type: Sequelize.BOOLEAN,
  12. allowNull: false,
  13. defaultValue: false
  14. } as Migration.Boolean
  15. return q.addColumn('Videos', 'nsfw', data)
  16. .then(() => {
  17. data.defaultValue = null
  18. return q.changeColumn('Videos', 'nsfw', data)
  19. })
  20. }
  21. function down (options) {
  22. throw new Error('Not implemented.')
  23. }
  24. export {
  25. up,
  26. down
  27. }