diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 20:07:54 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 20:07:54 +0200 |
commit | b0f9f39ed70299a208d1b388c72de8b7f3510cb7 (patch) | |
tree | 4b7d388125265533ac2f6d4bf457d018617e1db6 /server/initializers/migrations/0070-user-video-quota.ts | |
parent | e7dbeae8d915cdf4470ceb51c2724b04148b30b5 (diff) | |
download | PeerTube-b0f9f39ed70299a208d1b388c72de8b7f3510cb7.tar.gz PeerTube-b0f9f39ed70299a208d1b388c72de8b7f3510cb7.tar.zst PeerTube-b0f9f39ed70299a208d1b388c72de8b7f3510cb7.zip |
Begin user quota
Diffstat (limited to 'server/initializers/migrations/0070-user-video-quota.ts')
-rw-r--r-- | server/initializers/migrations/0070-user-video-quota.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/server/initializers/migrations/0070-user-video-quota.ts b/server/initializers/migrations/0070-user-video-quota.ts new file mode 100644 index 000000000..dec4d46dd --- /dev/null +++ b/server/initializers/migrations/0070-user-video-quota.ts | |||
@@ -0,0 +1,32 @@ | |||
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 | db: any | ||
9 | }): Promise<void> { | ||
10 | const q = utils.queryInterface | ||
11 | |||
12 | const data = { | ||
13 | type: Sequelize.BIGINT, | ||
14 | allowNull: false, | ||
15 | defaultValue: -1 | ||
16 | } | ||
17 | |||
18 | return q.addColumn('Users', 'videoQuota', data) | ||
19 | .then(() => { | ||
20 | data.defaultValue = null | ||
21 | return q.changeColumn('Users', 'videoQuota', data) | ||
22 | }) | ||
23 | } | ||
24 | |||
25 | function down (options) { | ||
26 | throw new Error('Not implemented.') | ||
27 | } | ||
28 | |||
29 | export { | ||
30 | up, | ||
31 | down | ||
32 | } | ||