2
1

0035-video-licence.ts 686 B

1234567891011121314151617181920212223242526272829303132
  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. }): Promise<void> {
  9. const q = utils.queryInterface
  10. const data = {
  11. type: Sequelize.INTEGER,
  12. allowNull: false,
  13. defaultValue: 0
  14. } as Migration.Integer
  15. return q.addColumn('Videos', 'licence', data)
  16. .then(() => {
  17. data.defaultValue = null
  18. return q.changeColumn('Videos', 'licence', data)
  19. })
  20. }
  21. function down (options) {
  22. throw new Error('Not implemented.')
  23. }
  24. export {
  25. up,
  26. down
  27. }