Fix video channel description/support max length
[oweals/peertube.git] / server / initializers / migrations / 0030-video-category.ts
1 import * as Sequelize from 'sequelize'
2 import * as Promise from 'bluebird'
3
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
11   const data = {
12     type: Sequelize.INTEGER,
13     allowNull: false,
14     defaultValue: 0
15   }
16
17   return q.addColumn('Videos', 'category', data)
18     .then(() => {
19       data.defaultValue = null
20
21       return q.changeColumn('Videos', 'category', data)
22     })
23 }
24
25 function down (options) {
26   throw new Error('Not implemented.')
27 }
28
29 export {
30   up,
31   down
32 }