2
1

0155-video-comments-enabled.ts 643 B

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