0430-auto-follow-notification-setting.ts 865 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import * as Sequelize from 'sequelize'
  2. async function up (utils: {
  3. transaction: Sequelize.Transaction
  4. queryInterface: Sequelize.QueryInterface
  5. sequelize: Sequelize.Sequelize
  6. db: any
  7. }): Promise<void> {
  8. {
  9. const data = {
  10. type: Sequelize.INTEGER,
  11. defaultValue: null,
  12. allowNull: true
  13. }
  14. await utils.queryInterface.addColumn('userNotificationSetting', 'autoInstanceFollowing', data)
  15. }
  16. {
  17. const query = 'UPDATE "userNotificationSetting" SET "autoInstanceFollowing" = 1'
  18. await utils.sequelize.query(query)
  19. }
  20. {
  21. const data = {
  22. type: Sequelize.INTEGER,
  23. defaultValue: null,
  24. allowNull: false
  25. }
  26. await utils.queryInterface.changeColumn('userNotificationSetting', 'autoInstanceFollowing', data)
  27. }
  28. }
  29. function down (options) {
  30. throw new Error('Not implemented.')
  31. }
  32. export {
  33. up,
  34. down
  35. }