d23e6a1c97
* fix migrations to not use config constant values as it can introduce bugs later when they change; (fixes #1259) remove constant fields imports from migrations * add migrations to update description and support fields to 1000 (fixes #1258) * fix client/server account and video_channel description/support fields to be max len 1000 (fixes #1258); fix test Should fail with a too long description; fix test Should fail with a long description; fix test Should fail with a long description; Remove USER.SUPPORT from constants since that field no longer exists; null not false, in migrations/0280-description-support.ts; video support field 1000, oops; * rename migration 0280-description-support.ts -> 0285-description-support.ts; update video support maxlength text
46 lines
1 KiB
TypeScript
46 lines
1 KiB
TypeScript
import * as Sequelize from 'sequelize'
|
|
import { VideoAbuseState } from '../../../shared/models/videos'
|
|
|
|
async function up (utils: {
|
|
transaction: Sequelize.Transaction
|
|
queryInterface: Sequelize.QueryInterface
|
|
sequelize: Sequelize.Sequelize
|
|
}): Promise<any> {
|
|
{
|
|
const data = {
|
|
type: Sequelize.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: null
|
|
}
|
|
await utils.queryInterface.addColumn('videoAbuse', 'state', data)
|
|
}
|
|
|
|
{
|
|
const query = 'UPDATE "videoAbuse" SET "state" = ' + VideoAbuseState.PENDING
|
|
await utils.sequelize.query(query)
|
|
}
|
|
|
|
{
|
|
const data = {
|
|
type: Sequelize.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: null
|
|
}
|
|
await utils.queryInterface.changeColumn('videoAbuse', 'state', data)
|
|
}
|
|
|
|
{
|
|
const data = {
|
|
type: Sequelize.STRING(300),
|
|
allowNull: true,
|
|
defaultValue: null
|
|
}
|
|
await utils.queryInterface.addColumn('videoAbuse', 'moderationComment', data)
|
|
}
|
|
}
|
|
|
|
function down (options) {
|
|
throw new Error('Not implemented.')
|
|
}
|
|
|
|
export { up, down }
|