diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-12 18:12:39 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-13 11:53:48 +0200 |
commit | ed638e5325096ef580da20f370ac61c59cd48cf7 (patch) | |
tree | 8ad4c1001efb3adc3946a6b6c9a3c1ed1f557995 /server/initializers/migrations | |
parent | 64cc5e8575fda47b281ae20abf0020e27fc8ce7c (diff) | |
download | PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.gz PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.zst PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.zip |
move to boolean switch
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0280-webtorrent-policy-user.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/server/initializers/migrations/0280-webtorrent-policy-user.ts b/server/initializers/migrations/0280-webtorrent-policy-user.ts index d24f6709e..e6488356a 100644 --- a/server/initializers/migrations/0280-webtorrent-policy-user.ts +++ b/server/initializers/migrations/0280-webtorrent-policy-user.ts | |||
@@ -1,6 +1,4 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { values } from 'lodash' | ||
3 | import { WEBTORRENT_POLICY_TYPES } from '../constants' | ||
4 | 2 | ||
5 | async function up (utils: { | 3 | async function up (utils: { |
6 | transaction: Sequelize.Transaction | 4 | transaction: Sequelize.Transaction |
@@ -9,18 +7,22 @@ async function up (utils: { | |||
9 | }): Promise<any> { | 7 | }): Promise<any> { |
10 | { | 8 | { |
11 | const data = { | 9 | const data = { |
12 | type: Sequelize.ENUM(values(WEBTORRENT_POLICY_TYPES)), | 10 | type: Sequelize.BOOLEAN, |
13 | allowNull: false, | 11 | allowNull: false, |
14 | defaultValue: 'enable' | 12 | defaultValue: true |
15 | } | 13 | } |
16 | 14 | ||
17 | await utils.queryInterface.addColumn('user', 'webTorrentPolicy', data) | 15 | await utils.queryInterface.addColumn('user', 'webTorrentEnabled', data) |
18 | } | 16 | } |
19 | 17 | ||
20 | } | 18 | } |
21 | 19 | ||
22 | function down (options) { | 20 | async function down (utils: { |
23 | throw new Error('Not implemented.') | 21 | transaction: Sequelize.Transaction |
22 | queryInterface: Sequelize.QueryInterface | ||
23 | sequelize: Sequelize.Sequelize | ||
24 | }): Promise<any> { | ||
25 | await utils.queryInterface.removeColumn('user', 'webTorrentEnabled') | ||
24 | } | 26 | } |
25 | 27 | ||
26 | export { up, down } | 28 | export { up, down } |