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