]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/migrations/0070-user-video-quota.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0070-user-video-quota.ts
CommitLineData
b0f9f39e
C
1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
c1e791ba 3import { Migration } from '../../models/migrations'
b0f9f39e
C
4
5function up (utils: {
a1587156
C
6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize
b0f9f39e
C
9 db: any
10}): Promise<void> {
11 const q = utils.queryInterface
12
13 const data = {
14 type: Sequelize.BIGINT,
15 allowNull: false,
16 defaultValue: -1
c1e791ba 17 } as Migration.BigInteger
b0f9f39e
C
18
19 return q.addColumn('Users', 'videoQuota', data)
20 .then(() => {
21 data.defaultValue = null
22 return q.changeColumn('Users', 'videoQuota', data)
23 })
24}
25
26function down (options) {
27 throw new Error('Not implemented.')
28}
29
30export {
31 up,
32 down
33}