ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0615-latest-versions-notification-settings.ts 1.1 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 notificationSettingColumns = [ 'newPeerTubeVersion', 'newPluginVersion' ]
  10. for (const column of notificationSettingColumns) {
  11. const data = {
  12. type: Sequelize.INTEGER,
  13. defaultValue: null,
  14. allowNull: true
  15. }
  16. await utils.queryInterface.addColumn('userNotificationSetting', column, data)
  17. }
  18. {
  19. const query = 'UPDATE "userNotificationSetting" SET "newPeerTubeVersion" = 3, "newPluginVersion" = 1'
  20. await utils.sequelize.query(query)
  21. }
  22. for (const column of notificationSettingColumns) {
  23. const data = {
  24. type: Sequelize.INTEGER,
  25. defaultValue: null,
  26. allowNull: false
  27. }
  28. await utils.queryInterface.changeColumn('userNotificationSetting', column, data)
  29. }
  30. }
  31. }
  32. function down (options) {
  33. throw new Error('Not implemented.')
  34. }
  35. export {
  36. up,
  37. down
  38. }