1
0
Fork 0
peertube/server/initializers/migrations/0245-user-blocked.ts
BRAINS YUM d23e6a1c97 Feature/description support fields length 1000 (#1267)
* 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
2018-10-19 08:54:01 +02:00

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 }