2
1

0040-video-nsfw.ts 647 B

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