0250-video-abuse-state.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import * as Sequelize from 'sequelize'
  2. import { VideoAbuseState } from '../../../shared/models/videos'
  3. async function up (utils: {
  4. transaction: Sequelize.Transaction
  5. queryInterface: Sequelize.QueryInterface
  6. sequelize: Sequelize.Sequelize
  7. }): Promise<any> {
  8. {
  9. const data = {
  10. type: Sequelize.INTEGER,
  11. allowNull: true,
  12. defaultValue: null
  13. }
  14. await utils.queryInterface.addColumn('videoAbuse', 'state', data)
  15. }
  16. {
  17. const query = 'UPDATE "videoAbuse" SET "state" = ' + VideoAbuseState.PENDING
  18. await utils.sequelize.query(query)
  19. }
  20. {
  21. const data = {
  22. type: Sequelize.INTEGER,
  23. allowNull: false,
  24. defaultValue: null
  25. }
  26. await utils.queryInterface.changeColumn('videoAbuse', 'state', data)
  27. }
  28. {
  29. const data = {
  30. type: Sequelize.STRING(300),
  31. allowNull: true,
  32. defaultValue: null
  33. }
  34. await utils.queryInterface.addColumn('videoAbuse', 'moderationComment', data)
  35. }
  36. }
  37. function down (options) {
  38. throw new Error('Not implemented.')
  39. }
  40. export { up, down }