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
45 lines
944 B
TypeScript
45 lines
944 B
TypeScript
import * as Sequelize from 'sequelize'
|
|
|
|
async function up (utils: {
|
|
transaction: Sequelize.Transaction
|
|
queryInterface: Sequelize.QueryInterface
|
|
sequelize: Sequelize.Sequelize
|
|
}): Promise<any> {
|
|
{
|
|
const data = {
|
|
type: Sequelize.BOOLEAN,
|
|
allowNull: true,
|
|
defaultValue: null
|
|
}
|
|
await utils.queryInterface.addColumn('user', 'blocked', data)
|
|
}
|
|
|
|
{
|
|
const query = 'UPDATE "user" SET "blocked" = false'
|
|
await utils.sequelize.query(query)
|
|
}
|
|
|
|
{
|
|
const data = {
|
|
type: Sequelize.BOOLEAN,
|
|
allowNull: false,
|
|
defaultValue: null
|
|
}
|
|
await utils.queryInterface.changeColumn('user', 'blocked', data)
|
|
}
|
|
|
|
{
|
|
const data = {
|
|
type: Sequelize.STRING(250),
|
|
allowNull: true,
|
|
defaultValue: null
|
|
}
|
|
await utils.queryInterface.addColumn('user', 'blockedReason', data)
|
|
}
|
|
}
|
|
|
|
function down (options) {
|
|
throw new Error('Not implemented.')
|
|
}
|
|
|
|
export { up, down }
|