blob: be9feb47aa2c7d8bdf6cf303df43272d8ea722da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import * as Sequelize from 'sequelize'
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
// We made a mistake with the migration in 2.2.0-rc.1
// Docker containers did not include this migration file
// So we check the table definition and add the column if it does not exist
const tableDefinition = await utils.queryInterface.describeTable('videoFile')
if (!tableDefinition['metadata']) {
const metadata = {
type: Sequelize.JSONB,
allowNull: true
}
await utils.queryInterface.addColumn('videoFile', 'metadata', metadata)
}
if (!tableDefinition['metadataUrl']) {
const metadataUrl = {
type: Sequelize.STRING,
allowNull: true
}
await utils.queryInterface.addColumn('videoFile', 'metadataUrl', metadataUrl)
}
}
function down (options) {
throw new Error('Not implemented.')
}
export {
up,
down
}
|