]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/migrations/0035-video-licence.ts
Move to promises
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0035-video-licence.ts
CommitLineData
6fcd19ba
C
1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
3
4function up (utils: {
5 transaction: Sequelize.Transaction,
6 queryInterface: Sequelize.QueryInterface,
7 sequelize: Sequelize.Sequelize
8}): Promise<void> {
6f0c39e2 9 const q = utils.queryInterface
6f0c39e2
C
10
11 const data = {
12 type: Sequelize.INTEGER,
13 allowNull: false,
14 defaultValue: 0
15 }
16
6fcd19ba
C
17 return q.addColumn('Videos', 'licence', data)
18 .then(() => {
6f0c39e2 19 data.defaultValue = null
6fcd19ba
C
20 return q.changeColumn('Videos', 'licence', data)
21 })
6f0c39e2
C
22}
23
65fcc311 24function down (options, callback) {
6f0c39e2
C
25 throw new Error('Not implemented.')
26}
65fcc311
C
27
28export {
29 up,
30 down
31}