2
1

0070-user-video-quota.ts 704 B

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