From a10fc78bb0e00e98c8f59edc16cd323b9c8b0615 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 9 May 2018 13:32:44 +0200 Subject: Fix video channel description/support max length --- server/initializers/constants.ts | 8 ++-- .../migrations/0215-video-support-length.ts | 44 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 server/initializers/migrations/0215-video-support-length.ts (limited to 'server/initializers') diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 6556aa168..c52c27c78 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -13,7 +13,7 @@ let config: IConfig = require('config') // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 210 +const LAST_MIGRATION_VERSION = 215 // --------------------------------------------------------------------------- @@ -192,8 +192,8 @@ const CONSTRAINTS_FIELDS = { }, VIDEO_CHANNELS: { NAME: { min: 3, max: 120 }, // Length - DESCRIPTION: { min: 3, max: 250 }, // Length - SUPPORT: { min: 3, max: 300 }, // Length + DESCRIPTION: { min: 3, max: 500 }, // Length + SUPPORT: { min: 3, max: 500 }, // Length URL: { min: 3, max: 2000 } // Length }, VIDEOS: { @@ -201,7 +201,7 @@ const CONSTRAINTS_FIELDS = { LANGUAGE: { min: 1, max: 10 }, // Length TRUNCATED_DESCRIPTION: { min: 3, max: 250 }, // Length DESCRIPTION: { min: 3, max: 10000 }, // Length - SUPPORT: { min: 3, max: 300 }, // Length + SUPPORT: { min: 3, max: 500 }, // Length IMAGE: { EXTNAME: [ '.jpg', '.jpeg' ], FILE_SIZE: { diff --git a/server/initializers/migrations/0215-video-support-length.ts b/server/initializers/migrations/0215-video-support-length.ts new file mode 100644 index 000000000..994eda60d --- /dev/null +++ b/server/initializers/migrations/0215-video-support-length.ts @@ -0,0 +1,44 @@ +import * as Sequelize from 'sequelize' +import { CONSTRAINTS_FIELDS } from '../index' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + { + const data = { + type: Sequelize.STRING(500), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('video', 'support', data) + } + + { + const data = { + type: Sequelize.STRING(500), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('videoChannel', 'support', data) + } + + { + const data = { + type: Sequelize.STRING(500), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('videoChannel', 'description', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3